Java 8 AsynchronousChannelGroup - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 AsynchronousChannelGroup class.

This code example shows how to use the following methods:awaitTermination, shutdownNow
    } 
 
    @Override 
    protected void doCloseImmediately() { 
        try { 
            group.shutdownNow();
            group.awaitTermination(5, TimeUnit.SECONDS);
        } catch (Exception e) {
            log.debug("Exception caught while closing channel group", e);
        } finally { 
            super.doCloseImmediately(); 
        } 
    } 
 
    public int getNioWorkers() { 
        String nioWorkers = manager.getProperties().get(FactoryManager.NIO_WORKERS);
        if (nioWorkers != null && nioWorkers.length() > 0) {
            int nb = Integer.parseInt(nioWorkers);
            if (nb > 0) {
                return nb;
5
CodeRank
This code example shows how to use the following methods:shutdown
            } 
        } 
    } 
 
    private static void quit() { 
        channelGroup.shutdown();
    } 
} 
4
CodeRank
This code example shows how to use the following methods:shutdown
            // class loader on the stack. 
            testAttackingTask(group1);
            testAttackingTask(group2);
        } finally { 
            group1.shutdown();
            group2.shutdown();
        } 
    } 
 
    static void testSimpleTask(AsynchronousChannelGroup group) throws Exception {
        Executor executor = (Executor)group;
        final CountDownLatch latch = new CountDownLatch(1);
        executor.execute(new Runnable() {
            public void run() { 
                latch.countDown();
            } 
        }); 
        latch.await();
    } 
 
4
CodeRank
This code example shows how to use the following methods:shutdown
See Code Examples for Java 8 AsynchronousChannelGroup Methods: