@Override public void run() { try { HttpAsyncRequestExecutor protocolHandler = new HttpAsyncRequestExecutor(); IOEventDispatch ioEventDispatch = new DefaultHttpClientIODispatch(protocolHandler, sslContext, connectionConfig); ioReactor.execute(ioEventDispatch); } catch (InterruptedIOException ex) { System.err.println("Interrupted"); } catch (IOException e) { System.err.println("I/O error: " + e.getMessage()); } } }, "jsonrpc4j HTTP IOReactor");
@Override public void shutdown() throws IOException { this.status = CLOSED; this.session.shutdown(); }
public void stop() throws IOException { if (this.ioReactor != null) { this.ioReactor.shutdown(2000); } }
@Override public Socket getSocket(){ if (this.session instanceof SocketAccessor){ return ((SocketAccessor) this.session).getSocket(); } else { return null; } }
/** * Closes out all I/O sessions maintained by this I/O reactor. */ protected void closeSessions() { synchronized (this.sessions) { for (final IOSession session : this.sessions) { session.close(); } } }
@Override public int getSocketTimeout() { return this.session.getSocketTimeout(); }
@Override public int fillBuffer(final ReadableByteChannel channel) throws IOException { final int bytesRead = this.sessionBuffer.fill(channel); if (bytesRead == -1) { this.endOfStream = true; } return bytesRead; }
@Override public boolean hasBufferedInput() { final SessionBufferStatus buffStatus = this.bufferStatus; return buffStatus != null && buffStatus.hasBufferedInput(); }
public IOReactorException(final String message, final Exception cause) { super(message); if (cause != null) { initCause(cause); } }
@Override public boolean hasBufferedOutput() { final SessionBufferStatus buffStatus = this.bufferStatus; return buffStatus != null && buffStatus.hasBufferedOutput(); }
/** * Handles the given {@link RuntimeException}. This method delegates * handling of the exception to the {@link IOReactorExceptionHandler}, * if available. * * @param ex the runtime exception. */ protected void handleRuntimeException(final RuntimeException ex) { if (this.exceptionHandler == null || !this.exceptionHandler.handle(ex)) { throw ex; } }
@Override public void shutdown() throws IOException { this.status = CLOSED; this.session.shutdown(); }
@Override public Socket getSocket() { if (this.session instanceof SocketAccessor) { return ((SocketAccessor) this.session).getSocket(); } else { return null; } }
@Override public int fillBuffer(final ReadableByteChannel channel) throws IOException { final int bytesRead = this.sessionBuffer.fill(channel); if (bytesRead == -1) { this.endOfStream = true; } return bytesRead; }
@Override public boolean hasBufferedInput() { final SessionBufferStatus buffStatus = this.bufferStatus; return buffStatus != null && buffStatus.hasBufferedInput(); }
public IOReactorException(final String message, final Exception cause) { super(message); if (cause != null) { initCause(cause); } }
@Override public Socket getSocket() { if (this.session instanceof SocketAccessor) { return ((SocketAccessor) this.session).getSocket(); } else { return null; } }
@Override public Socket getSocket(){ if (this.session instanceof SocketAccessor){ return ((SocketAccessor) this.session).getSocket(); } else { return null; } }