use of java.nio.channels.spi.AsynchronousChannelProvider in project j2objc by google.
the class AsynchronousSocketChannelTest method test_group.
public void test_group() throws Exception {
AsynchronousChannelProvider provider = AsynchronousChannelProvider.provider();
AsynchronousChannelGroup group = provider.openAsynchronousChannelGroup(2, Executors.defaultThreadFactory());
AsynchronousSocketChannel asc = AsynchronousSocketChannel.open(group);
assertEquals(provider, asc.provider());
asc.close();
}
use of java.nio.channels.spi.AsynchronousChannelProvider in project j2objc by google.
the class AsynchronousServerSocketChannelTest method test_group.
public void test_group() throws Throwable {
AsynchronousChannelProvider provider = AsynchronousChannelProvider.provider();
AsynchronousChannelGroup group = provider.openAsynchronousChannelGroup(2, Executors.defaultThreadFactory());
AsynchronousServerSocketChannel assc = AsynchronousServerSocketChannel.open(group);
assertNull(assc.getLocalAddress());
assc.bind(new InetSocketAddress(0));
assertNotNull(assc.getLocalAddress());
assertEquals(provider, assc.provider());
assc.close();
}
use of java.nio.channels.spi.AsynchronousChannelProvider in project j2objc by google.
the class AsynchronousChannelProviderTest method test_open_methods.
public void test_open_methods() throws Exception {
AsynchronousChannelProvider provider = AsynchronousChannelProvider.provider();
assertNotNull(provider);
assertSame(AsynchronousChannelProvider.provider(), provider);
assertNotNull(provider.openAsynchronousChannelGroup(1, new TestThreadFactory()));
assertNotNull(provider.openAsynchronousChannelGroup(Executors.newSingleThreadExecutor(), 1));
assertNotNull(provider.openAsynchronousServerSocketChannel(AsynchronousChannelGroup.withFixedThreadPool(1, new TestThreadFactory())));
assertNotNull(provider.openAsynchronousSocketChannel(AsynchronousChannelGroup.withFixedThreadPool(1, new TestThreadFactory())));
assertNotNull(provider.openAsynchronousChannelGroup(1, new TestThreadFactory()));
}
use of java.nio.channels.spi.AsynchronousChannelProvider in project baseio by generallycloud.
the class AioSocketChannelContext method initializeChannelGroup.
private void initializeChannelGroup(int SERVER_CORE_SIZE) throws IOException {
String threadName = "aio-process(tcp-" + getServerConfiguration().getSERVER_PORT() + ")";
AsynchronousChannelProvider provider = AsynchronousChannelProvider.provider();
CachedAioThreadFactory cachedAioThreadFactory = new CachedAioThreadFactory(this, threadName);
this.asynchronousChannelGroup = provider.openAsynchronousChannelGroup(SERVER_CORE_SIZE, cachedAioThreadFactory);
}
Aggregations