当前位置: 首页>>代码示例>>Java>>正文


Java AbstractSelector类代码示例

本文整理汇总了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());
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:21,代码来源:AbstractSelectorTest.java

示例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);
        }
    };
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:DefaultSelectorProvider.java

示例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);
}
 
开发者ID:vilie,项目名称:javify,代码行数:35,代码来源:SelectorProviderImpl.java

示例4: openSelector

import java.nio.channels.spi.AbstractSelector; //导入依赖的package包/类
public AbstractSelector openSelector() throws IOException {
    return new WindowsSelectorImpl(this);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:WindowsSelectorProvider.java

示例5: openSelector

import java.nio.channels.spi.AbstractSelector; //导入依赖的package包/类
public AbstractSelector openSelector() throws IOException {
    return provider.openSelector();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:4,代码来源:InheritedChannelNotServerSocket.java

示例6: openSelector

import java.nio.channels.spi.AbstractSelector; //导入依赖的package包/类
public AbstractSelector openSelector()
    throws IOException
{
    return provider.openSelector();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:6,代码来源:RMIDSelectorProvider.java

示例7: openSelector

import java.nio.channels.spi.AbstractSelector; //导入依赖的package包/类
public AbstractSelector openSelector() throws IOException {
    return new SelectorImpl(this);
}
 
开发者ID:Sellegit,项目名称:j2objc,代码行数:4,代码来源:SelectorProviderImpl.java

示例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);
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:7,代码来源:SelectorProviderImpl.java

示例9: openSelector

import java.nio.channels.spi.AbstractSelector; //导入依赖的package包/类
@Override
public AbstractSelector openSelector() {
    return new MockAbstractSelector(provider());
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:5,代码来源:AbstractSelectorTest.java

示例10: openSelector

import java.nio.channels.spi.AbstractSelector; //导入依赖的package包/类
public AbstractSelector openSelector() throws IOException {
    return new EpollSelectorImpl(this);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:4,代码来源:EpollSelectorProviderImpl.java

示例11: openSelector

import java.nio.channels.spi.AbstractSelector; //导入依赖的package包/类
public AbstractSelector openSelector() throws IOException {
    return MockAbstractSelector.openSelector();
}
 
开发者ID:shannah,项目名称:cn1,代码行数:4,代码来源:SelectorProviderTest.java

示例12: openSelector

import java.nio.channels.spi.AbstractSelector; //导入依赖的package包/类
@Override
public AbstractSelector openSelector() throws IOException {
	return null;
}
 
开发者ID:alei121,项目名称:rawsocketspi,代码行数:5,代码来源:RSSelectorProvider.java


注:本文中的java.nio.channels.spi.AbstractSelector类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。