本文整理汇总了Java中java.nio.channels.spi.AbstractSelector类的典型用法代码示例。如果您正苦于以下问题:Java AbstractSelector类的具体用法?Java AbstractSelector怎么用?Java AbstractSelector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AbstractSelector类属于java.nio.channels.spi包,在下文中一共展示了AbstractSelector类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test_deregister
import java.nio.channels.spi.AbstractSelector; //导入依赖的package包/类
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "deregister",
args = {AbstractSelectionKey.class}
)
public void test_deregister() throws Exception {
MockSelectorProvider prov = new MockSelectorProvider();
AbstractSelector acceptSelector = prov.openSelector();
SocketChannel sc = prov.openSocketChannel();
sc.configureBlocking(false);
SelectionKey acceptKey = sc.register(acceptSelector,
SelectionKey.OP_READ, null);
assertTrue(sc.isRegistered());
assertNotNull(acceptKey);
((MockAbstractSelector)acceptSelector).mockDeregister(
(MockAbstractSelector.MockSelectionKey)acceptKey);
assertFalse(sc.isRegistered());
}
示例2: create
import java.nio.channels.spi.AbstractSelector; //导入依赖的package包/类
/**
* Returns the default SelectorProvider.
*/
public static SelectorProvider create() {
return new SelectorProviderImpl() {
public AbstractSelector openSelector() throws IOException {
return new DotNetSelectorImpl(this);
}
};
}
示例3: openSelector
import java.nio.channels.spi.AbstractSelector; //导入依赖的package包/类
public AbstractSelector openSelector ()
throws IOException
{
String selectorImpl = "default";
if (KqueueSelectorImpl.kqueue_supported())
selectorImpl = SELECTOR_IMPL_KQUEUE;
if (EpollSelectorImpl.epoll_supported() && !epoll_failed)
selectorImpl = SELECTOR_IMPL_EPOLL;
selectorImpl = SystemProperties.getProperty(SELECTOR_IMPL, selectorImpl);
if (selectorImpl.equals(SELECTOR_IMPL_KQUEUE))
return new KqueueSelectorImpl(this);
if (selectorImpl.equals(SELECTOR_IMPL_EPOLL))
{
// We jump through these hoops because even though epoll may look
// like it's available (sys/epoll.h exists, and you can link against
// all the epoll functions) it may not be available in the kernel
// (especially 2.4 kernels), meaning you will get ENOSYS at run time.
//
// Madness!
try
{
return new EpollSelectorImpl(this);
}
catch (InternalError e)
{
// epoll_create throws this on ENOSYS.
epoll_failed = true;
}
}
return new SelectorImpl (this);
}
示例4: openSelector
import java.nio.channels.spi.AbstractSelector; //导入依赖的package包/类
public AbstractSelector openSelector() throws IOException {
return new WindowsSelectorImpl(this);
}
示例5: openSelector
import java.nio.channels.spi.AbstractSelector; //导入依赖的package包/类
public AbstractSelector openSelector() throws IOException {
return provider.openSelector();
}
示例6: openSelector
import java.nio.channels.spi.AbstractSelector; //导入依赖的package包/类
public AbstractSelector openSelector()
throws IOException
{
return provider.openSelector();
}
示例7: openSelector
import java.nio.channels.spi.AbstractSelector; //导入依赖的package包/类
public AbstractSelector openSelector() throws IOException {
return new SelectorImpl(this);
}
示例8: openSelector
import java.nio.channels.spi.AbstractSelector; //导入依赖的package包/类
/**
* @see java.nio.channels.spi.SelectorProvider#openSelector()
*/
public AbstractSelector openSelector() throws IOException {
return new SelectorImpl(this);
}
示例9: openSelector
import java.nio.channels.spi.AbstractSelector; //导入依赖的package包/类
@Override
public AbstractSelector openSelector() {
return new MockAbstractSelector(provider());
}
示例10: openSelector
import java.nio.channels.spi.AbstractSelector; //导入依赖的package包/类
public AbstractSelector openSelector() throws IOException {
return new EpollSelectorImpl(this);
}
示例11: openSelector
import java.nio.channels.spi.AbstractSelector; //导入依赖的package包/类
public AbstractSelector openSelector() throws IOException {
return MockAbstractSelector.openSelector();
}
示例12: openSelector
import java.nio.channels.spi.AbstractSelector; //导入依赖的package包/类
@Override
public AbstractSelector openSelector() throws IOException {
return null;
}