mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8236246: SelectorProvider support for creating a DatagramChannel that is not interruptible
Reviewed-by: chegar
This commit is contained in:
parent
d1ad0eaf8f
commit
c6a4cea7a0
11 changed files with 350 additions and 109 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -25,13 +25,19 @@
|
|||
|
||||
package sun.nio.ch;
|
||||
|
||||
import java.nio.channels.spi.SelectorProvider;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
/**
|
||||
* Creates this platform's default SelectorProvider
|
||||
*/
|
||||
|
||||
public class DefaultSelectorProvider {
|
||||
private static final SelectorProviderImpl INSTANCE;
|
||||
static {
|
||||
PrivilegedAction<SelectorProviderImpl> pa = KQueueSelectorProvider::new;
|
||||
INSTANCE = AccessController.doPrivileged(pa);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent instantiation.
|
||||
|
@ -39,9 +45,9 @@ public class DefaultSelectorProvider {
|
|||
private DefaultSelectorProvider() { }
|
||||
|
||||
/**
|
||||
* Returns the default SelectorProvider.
|
||||
* Returns the default SelectorProvider implementation.
|
||||
*/
|
||||
public static SelectorProvider create() {
|
||||
return new KQueueSelectorProvider();
|
||||
public static SelectorProviderImpl get() {
|
||||
return INSTANCE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue