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

This code example shows how to use the following methods:
 
    TransportCallback<RestResponse> callback = removeAttachment(ctx);
    if (callback != null)
    { 
      LOG.debug("{}: active channel closed", e.getChannel().getRemoteAddress());
      callback.onResponse(TransportResponseImpl.<RestResponse>error(new ClosedChannelException(),
                                                                    Collections.<String, String>emptyMap()));
    } 
    else 
    { 
      LOG.debug("{}: idle channel closed", e.getChannel().getRemoteAddress());
    } 
    super.channelClosed(ctx, e);
  } 
} 
7
CodeRank
This code example shows how to use the following methods:getCause, getLocalizedMessage, getMessage
 
    /** 
     * @tests {@link java.nio.channels.ClosedChannelException#ClosedChannelException()} 
     */ 
    public void test_Constructor() { 
        ClosedChannelException e = new ClosedChannelException();
        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:
 
    TransportCallback<RestResponse> callback = removeAttachment(ctx);
    if (callback != null)
    { 
      LOG.debug("{}: active channel closed", e.getChannel().getRemoteAddress());
      callback.onResponse(TransportResponseImpl.<RestResponse>error(new ClosedChannelException(),
                                                                    Collections.<String, String>emptyMap()));
    } 
    else 
    { 
      LOG.debug("{}: idle channel closed", e.getChannel().getRemoteAddress());
    } 
    super.channelClosed(ctx, e);
  } 
} 
6
CodeRank
This code example shows how to use the following methods:
    } 
 
    @Override 
    protected void checkClosed() throws IOException { 
      if (isClosed) {
        throw new ClosedChannelException();
      } 
    } 
  } 
 
  @Override 
  public FSDataOutputStream createInternal(Path f,
      EnumSet<CreateFlag> createFlag, FsPermission absolutePermission,
      int bufferSize, short replication, long blockSize, Progressable progress,
      ChecksumOpt checksumOpt, boolean createParent) throws IOException {
    final FSDataOutputStream out = new FSDataOutputStream(
        new ChecksumFSOutputSummer(this, f, createFlag, absolutePermission,
            bufferSize, replication, blockSize, progress,
            checksumOpt,  createParent), null);
    return out;
6
CodeRank
This code example shows how to use the following methods:getCause, getLocalizedMessage, getMessage
     
    /** 
     * @tests {@link java.nio.channels.ClosedChannelException#ClosedChannelException()} 
     */ 
    public void test_Constructor() { 
        ClosedChannelException e = new ClosedChannelException();
        assertNull(e.getMessage());
        assertNull(e.getLocalizedMessage());
        assertNull(e.getCause());
    } 
 
    /** 
     * @tests serialization/deserialization compatibility. 
     */ 
    public void testSerializationSelf() throws Exception {
 
        SerializationTest.verifySelf(new ClosedChannelException());
    } 
 
    /** 
6
CodeRank
This code example shows how to use the following methods:getCause, getLocalizedMessage, getMessage
     
    /** 
     * @tests {@link java.nio.channels.ClosedChannelException#ClosedChannelException()} 
     */ 
    public void test_Constructor() { 
        ClosedChannelException e = new ClosedChannelException();
        assertNull(e.getMessage());
        assertNull(e.getLocalizedMessage());
        assertNull(e.getCause());
    } 
 
    /** 
     * @tests serialization/deserialization compatibility. 
     */ 
    public void testSerializationSelf() throws Exception { 
 
        SerializationTest.verifySelf(new ClosedChannelException());
    } 
 
    /** 
7
CodeRank
This code example shows how to use the following methods:
    }; 
 
    private static final OutputStream CLOSED_OUT = new OutputStream() {
        @Override 
        public void write(int b) throws IOException { 
            throw new ClosedChannelException(); 
        } 
    }; 
 
    private InputStream is;
    private OutputStream os;
    private WritableByteChannel outChannel;
 
    /** 
     * Create a new instance 
     * 
     * @param parent    the parent {@link Channel} which was used to create this instance. This can be null if the 
     *                  {@link} has no parent as it was created by your self. 
     */ 
    protected OioByteStreamChannel(Channel parent) {
6
CodeRank
This code example shows how to use the following methods:
 
    public void onClose() 
    { 
        Callback callback = _interested.get();
        if (callback != null && _interested.compareAndSet(callback, null))
            callback.failed(new ClosedChannelException());
    } 
 
    @Override 
    public String toString()
    { 
        return String.format("FillInterest@%x{%b,%s}", hashCode(), _interested.get(), _interested.get());
    } 
     
    /** 
     * Register the read interest 
     * Abstract method to be implemented by the Specific ReadInterest to 
     * enquire if a read is immediately possible and if not to schedule a future 
     * call to {@link #fillable()} or {@link #onFail(Throwable)} 
     * 
6
CodeRank
This code example shows how to use the following methods:
      delegate.close();
   } 
 
   private void checkOpen() throws ClosedChannelException {
      if (!isOpen()) { 
         throw new ClosedChannelException();
      } 
   } 
} 
5
CodeRank
This code example shows how to use the following methods:
      delegate.close();
   } 
 
   private void checkOpen() throws ClosedChannelException {
      if (!isOpen()) { 
         throw new ClosedChannelException();
      } 
   } 
 
   public long size() throws IOException {
      return gridInputStream.getFileSize();
   } 
} 
5
CodeRank
See Code Examples for Java 8 ClosedChannelException Methods: