Package java.nio.channels

Examples of java.nio.channels.ClosedChannelException


     
    if (!isDisconnected.getAndSet(true)) {
     
      // notify pending handlers
      while (!handlersWaitingForResponseHeader.isEmpty()) {
          handlersWaitingForResponseHeader.remove(0).onException(new ClosedChannelException());
      }
     
     
      // notify waiting handler
      for (MessageHeaderHandler messageHandler : getHandlersWaitingForResponseCopy()) {
        ClosedChannelException cce = newDetailedClosedChannelException("channel " + getId() + " is closed (by peer?) while receiving response data " +
                                                                            "(countMessagesSent=" + getCountMessagesSent() + ", countMessagesReceived=" + getCountMessagesReceived() +
                                                                            ", countReceivedBytes=" + getCountReceivedBytes() + ")");
        messageHandler.onException(cce);
      }
      handlersWaitingForResponseHeader.clear();
View Full Code Here


        destroy();
        throw new IOException(msg);
      }
     
    } else {
      throw new ClosedChannelException();
    }   
  }
View Full Code Here

        destroy();
        throw new IOException(msg);
      }
     
    } else {
      throw new ClosedChannelException();
    }   

  }
View Full Code Here

        destroy();
        throw new IOException(msg);
      }
       
    } else {
      throw new ClosedChannelException();
    }
  }
View Full Code Here

   
    IMessageWriter messageWriter = new IMessageWriter() {
       
        public void flush(ByteBuffer[] bodyData, boolean isContentImmutable, FlushMode flushMode, IWriteCompletionHandler completionHandler) throws IOException {
          if (!bodyDataSource.isOpen()) {
            throw new ClosedChannelException();
          }
        bodyDataSource.append(isContentImmutable, bodyData, completionHandler);
      }
       
      public void close() throws IOException {
View Full Code Here

        {
            if ( _written > _lastFlush ) super.flush();
        }
        catch ( IOException e )
        {
            throw new ClosedChannelException();
        }
        finally
        {
            _lastFlush = _written;
        }
View Full Code Here

                    flush();
                }
            }
            catch ( IOException e )
            {
                throw new ClosedChannelException();
            }
            finally
            {
                _isClosed = true;
                _written = 0;
View Full Code Here

        }
        catch ( IOException e )
        {
            // most likely the sender did close the connection or something other (firewall?) does interfere the
            // communication
            ClosedChannelException che = new ClosedChannelException();
            che.setStackTrace( e.getStackTrace() );
            che.initCause( e.getCause() );
            throw che;
        }

        if ( buffer.hasRemaining() )
        {
            if ( read == -1 )
            {
                throw new ClosedChannelException();
            }
            else
            {
                logger.log( Level.FINEST, "Incomplete read detected, registering for read again." );
                throw new IncompleteIOException( buffer, SelectionKey.OP_READ );
View Full Code Here

            while ( read != -1 && buffer.hasRemaining() && (timePeriod < timeout) );
        }
        catch ( IOException e )
        {
            // most likely the sender did close the connection
            ClosedChannelException che = new ClosedChannelException();
            che.setStackTrace( e.getStackTrace() );
            che.initCause( e.getCause() );
            throw che;
        }

        if ( timePeriod >= timeout )
        {
            throw new SocketTimeoutException();
        }

        if ( buffer.hasRemaining() )
        {
            if ( read == -1 )
            {
                throw new ClosedChannelException();
            }
            else
            {
                logger.log( Level.FINEST, "Incomplete read detected, registering for read again." );
                throw new IncompleteIOException( buffer, SelectionKey.OP_READ );
View Full Code Here

              }

            waitingForData(readGuard, remainingTime);
           
          } else {
            throw new ClosedChannelException();
          }
        }
      }

      remainingTime = computeRemainingTime(start, receiveTimeoutSec);
View Full Code Here

TOP

Related Classes of java.nio.channels.ClosedChannelException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.