Java 8 AsynchronousCloseException - 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 AsynchronousCloseException class.

This code example shows how to use the following methods:getCause, getLocalizedMessage, getMessage
 
    /** 
     * @tests {@link java.nio.channels.AsynchronousCloseException#AsynchronousCloseException()} 
     */ 
    public void test_Constructor() { 
        AsynchronousCloseException e = new AsynchronousCloseException();
        assertNull(e.getMessage());
        assertNull(e.getLocalizedMessage());
        assertNull(e.getCause());
    } 
 
    /** 
     * @tests serialization/deserialization compatibility. 
     */ 
    @TestTargets({ 
        @TestTargetNew( 
            level = TestLevel.COMPLETE, 
            notes = "Verifies serialization/deserialization compatibility.", 
            method = "!SerializationSelf", 
            args = {} 
7
CodeRank
This code example shows how to use the following methods:getCause, getLocalizedMessage, getMessage
 
    /** 
     * @tests {@link java.nio.channels.AsynchronousCloseException#AsynchronousCloseException()} 
     */ 
    public void test_Constructor() { 
        AsynchronousCloseException e = new AsynchronousCloseException();
        assertNull(e.getMessage());
        assertNull(e.getLocalizedMessage());
        assertNull(e.getCause());
    } 
     
    /** 
     * @tests serialization/deserialization compatibility. 
     */ 
    public void testSerializationSelf() throws Exception {
 
        SerializationTest.verifySelf(new AsynchronousCloseException());
    } 
 
    /** 
6
CodeRank
This code example shows how to use the following methods:getCause, getLocalizedMessage, getMessage
 
    /** 
     * @tests {@link java.nio.channels.AsynchronousCloseException#AsynchronousCloseException()} 
     */ 
    public void test_Constructor() { 
        AsynchronousCloseException e = new AsynchronousCloseException();
        assertNull(e.getMessage());
        assertNull(e.getLocalizedMessage());
        assertNull(e.getCause());
    } 
     
    /** 
     * @tests serialization/deserialization compatibility. 
     */ 
    public void testSerializationSelf() throws Exception { 
 
        SerializationTest.verifySelf(new AsynchronousCloseException());
    } 
 
    /** 
6
CodeRank
This code example shows how to use the following methods:
   * @throws AsynchronousCloseException  If the status is closed. 
   */ 
  public void unreferenceCheckClosed() throws ClosedChannelException {
    int newVal = status.decrementAndGet();
    if ((newVal & STATUS_CLOSED_MASK) != 0) {
      throw new AsynchronousCloseException();
    } 
  } 
 
  /** 
   * Return true if the status is currently open. 
   * 
   * @return                 True if the status is currently open. 
   */ 
  public boolean isOpen() { 
    return ((status.get() & STATUS_CLOSED_MASK) == 0);
  } 
 
  /** 
   * Mark the status as closed. 
5
CodeRank
This code example shows how to use the following methods:
    } 
 
    @Override 
    public void close() 
    { 
        close(new AsynchronousCloseException());
    } 
 
    protected void close(Throwable failure)
    { 
        if (softClose()) 
        { 
            // First close then abort, to be sure that the connection cannot be reused 
            // from an onFailure() handler or by blocking code waiting for completion. 
            getHttpDestination().close(this);
            getEndPoint().shutdownOutput(); 
            if (LOG.isDebugEnabled()) 
                LOG.debug("{} oshut", this);
            getEndPoint().close(); 
            if (LOG.isDebugEnabled()) 
5
CodeRank
This code example shows how to use the following methods:
 
        if (closed)
        { 
            if (LOG.isDebugEnabled())
                LOG.debug("InputStream closed, ignored content {}", content);
            callback.failed(new AsynchronousCloseException());
        } 
    } 
 
    @Override 
    public void onSuccess(Response response)
    { 
        synchronized (lock)
        { 
            chunk = EOF;
            lock.notifyAll();
        } 
 
        if (LOG.isDebugEnabled())
            LOG.debug("End of content");
4
CodeRank
This code example shows how to use the following methods:
        return exchanges.remove(exchange);
    } 
 
    public void close() 
    { 
        abort(new AsynchronousCloseException());
        if (LOG.isDebugEnabled())
            LOG.debug("Closed {}", this);
    } 
 
    public void release(Connection connection)
    { 
    } 
 
    public void close(Connection connection)
    { 
    } 
 
    /** 
     * Aborts all the {@link HttpExchange}s queued in this destination. 
4
CodeRank
This code example shows how to use the following methods:
    } 
 
    @Override 
    public void close() 
    { 
        close(new AsynchronousCloseException());
    } 
 
    protected void close(Throwable failure)
    { 
        if (closed.compareAndSet(false, true))
        { 
            getHttpDestination().close(this);
 
            abort(failure);
 
            session.close(ErrorCode.NO_ERROR.code, failure.getMessage(), Callback.NOOP);
        } 
    } 
 
4
CodeRank
This code example shows how to use the following methods:
    } 
 
    @Override 
    public void close() 
    { 
        close(new AsynchronousCloseException());
    } 
 
    protected void close(Throwable failure)
    { 
        if (closed.compareAndSet(false, true))
        { 
            getHttpDestination().close(this);
 
            abort(failure);
 
            getEndPoint().shutdownOutput(); 
            if (LOG.isDebugEnabled())
                LOG.debug("Shutdown {}", this);
            getEndPoint().close(); 
4
CodeRank
This code example shows how to use the following methods:
 
		List<OFMessage> msgs = null;
        int bytesRead = -1;        
        bytesRead = socket.read(inBuffer);
        if (bytesRead < 0) {
			throw new AsynchronousCloseException();
        } 
 
        inBuffer.flip();
        msgs = factory.parseMessages(inBuffer);
        if (inBuffer.hasRemaining()) {
            inBuffer.compact();
        } else { 
            inBuffer.clear();
        } 
        return msgs;
    } 
 
	@Override 
	public void stop() { 
4
CodeRank
See Code Examples for Java 8 AsynchronousCloseException Methods: