Code example for AtomicReference

Methods: set

0
                try { 
                    ch.close();
                } catch (IOException ignore) { }
            } 
            public void failed(Throwable exc, Void att) {
                exception.set(exc);
            } 
        }); 
 
        // check AcceptPendingException 
        try { 
            listener.accept();
            throw new RuntimeException("AcceptPendingException expected");
        } catch (AcceptPendingException x) {
        } 
 
        // asynchronous close 
        listener.close();
        while (exception.get() == null)
            Thread.sleep(100);
Connect your IDE to all the code out there  Get Codota for Java