/** * This is used to cancel the operation if it has timed out. If * the retry is waiting too long to read content from the socket * then the retry is canceled and the underlying transport is * closed. This helps to clean up occupied resources. */ public void cancel() { try { channel.close(); } catch(Throwable e) { return; } } }
/** * This is used to cancel the operation if it has timed out. If * the retry is waiting too long to read content from the socket * then the retry is cancelled and the underlying transport is * closed. This helps to clean up occupied resources. */ public void cancel() { try { channel.close(); } catch(Throwable cause) { trace.trace(ERROR, cause); } } }
/** * This is used to cancel the operation if it has timed out. If * the retry is waiting too long to read content from the socket * then the retry is cancelled and the underlying transport is * closed. This helps to clean up occupied resources. */ public void cancel() { try { channel.close(); } catch(Throwable cause) { trace.trace(ERROR, cause); } } }
/** * This is used to close the session and send a 1011 close code * to the client indicating an internal server error. Closing * of the session in this manner only occurs if there is an * expiry of the session or an I/O error, both of which are * unexpected and violate the behaviour as defined in RFC 6455. */ public void failure() { try { connection.close(error); channel.close(); } catch(Exception cause) { trace.trace(ERROR, cause); channel.close(); } }
/** * This is used to close the session and send a 1000 close code * to the client indicating a normal closure. This will be called * when there is a close notification dispatched to the status * listener. Typically here a graceful closure is best. */ public void close() { try { connection.close(normal); channel.close(); } catch(Exception cause) { trace.trace(ERROR, cause); channel.close(); } } }
/** * This is used to close the session and send a 1011 close code * to the client indicating an internal server error. Closing * of the session in this manner only occurs if there is an * expiry of the session or an I/O error, both of which are * unexpected and violate the behaviour as defined in RFC 6455. */ public void failure() { try { connection.close(error); channel.close(); } catch(Exception cause) { trace.trace(ERROR, cause); channel.close(); } }
/** * This is used to close the session and send a 1000 close code * to the client indicating a normal closure. This will be called * when there is a close notification dispatched to the status * listener. Typically here a graceful closure is best. */ public void close() { try { connection.close(normal); channel.close(); } catch(Exception cause) { trace.trace(ERROR, cause); channel.close(); } } }
/** * If the connection gets a response to its ping message then this * will reset the internal counter. This ensure that the connection * does not time out. If after three pings there is not response * from the other side then the connection will be terminated. */ public void refresh() { try { trace.trace(PONG_RECEIVED); counter.set(0); } catch(Exception cause) { trace.trace(ERROR, cause); channel.close(); } }
/** * If the connection gets a response to its ping message then this * will reset the internal counter. This ensure that the connection * does not time out. If after three pings there is not response * from the other side then the connection will be terminated. */ public void refresh() { try { trace.trace(PONG_RECEIVED); counter.set(0); } catch(Exception cause) { trace.trace(ERROR, cause); channel.close(); } }
/** * This is called when a read operation has timed out. To ensure * that stale channels do not remain registered they are cleared * out with this method and a close frame is sent if possible. */ public void cancel() { try{ processor.close(); } catch(Exception cause) { trace.trace(ERROR, cause); channel.close(); } } }
/** * This <code>run</code> method is used to collect the bytes from * the connected channel. If a sufficient amount of data is read * from the socket to form a HTTP entity then the collector uses * the <code>Selector</code> object to dispatch the request. This * is sequence of events that occur for each transaction. */ public void run() { try { collector.collect(controller); }catch(Throwable cause){ trace.trace(ERROR, cause); channel.close(); } }
/** * This is called when a read operation has timed out. To ensure * that stale channels do not remain registered they are cleared * out with this method and a close frame is sent if possible. */ public void cancel() { try{ processor.close(); } catch(Exception cause) { trace.trace(ERROR, cause); channel.close(); } } }
/** * This <code>run</code> method is used to collect the bytes from * the connected channel. If a sufficient amount of data is read * from the socket to form a HTTP entity then the collector uses * the <code>Selector</code> object to dispatch the request. This * is sequence of events that occur for each transaction. */ public void run() { try { collector.collect(controller); }catch(Throwable cause){ trace.trace(ERROR, cause); channel.close(); } }
/** * This <code>dispatch</code> method will dispatch the request * and response objects to the container. This will interpret the * target and semantics from the request object and compose a * response for the request which is sent to the connected client. * If there is an exception this will close the socket channel. */ private void dispatch() throws Exception { try { trace.trace(DISPATCH_REQUEST); container.handle(request, response); } catch(Throwable cause) { trace.trace(ERROR, cause); channel.close(); } } }
/** * This <code>dispatch</code> method will dispatch the request * and response objects to the container. This will interpret the * target and semantics from the request object and compose a * response for the request which is sent to the connected client. * If there is an exception this will close the socket channel. */ private void dispatch() throws Exception { try { trace.trace(DISPATCH_REQUEST); container.handle(request, response); } catch(Throwable cause) { trace.trace(ERROR, cause); channel.close(); } } }
/** * This <code>dispatch</code> method will dispatch the request * and response objects to the container. This will interpret the * target and semantics from the request object and compose a * response for the request which is sent to the connected client. * If there is an exception this will close the socket channel. */ private void dispatch() throws Exception { try { trace.trace(DISPATCH_REQUEST); container.handle(request, response); } catch(Throwable cause) { trace.trace(ERROR, cause); channel.close(); } } }
/** * This is used to kick of the status checking. Here an initial * ping is sent over the socket and the task is then scheduled to * check the result after the frequency period has expired. If * this method fails for any reason the TCP channel is closed. */ public void start() { try { connection.register(listener); trace.trace(WRITE_PING); connection.send(frame); counter.getAndIncrement(); scheduler.execute(this, frequency); } catch(Exception cause) { trace.trace(ERROR, cause); channel.close(); } }
/** * This is used to kick of the status checking. Here an initial * ping is sent over the socket and the task is then scheduled to * check the result after the frequency period has expired. If * this method fails for any reason the TCP channel is closed. */ public void start() { try { connection.register(listener); trace.trace(WRITE_PING); connection.send(frame); counter.getAndIncrement(); scheduler.execute(this, frequency); } catch(Exception cause) { trace.trace(ERROR, cause); channel.close(); } }
/** * This method is used to terminate the connection and commit the * response. Terminating the session before it has been dispatched * is done when there is a protocol or an unexpected I/O error with * the underlying TCP channel. * * @param request this is the session initiating request * @param response this is the session initiating response */ public void terminate(Request request, Response response) { Channel channel = request.getChannel(); Trace trace = channel.getTrace(); try { response.close(); channel.close(); trace.trace(TERMINATE_SOCKET); } catch(Exception cause) { trace.trace(ERROR, cause); } } }
/** * This method is used to terminate the connection and commit the * response. Terminating the session before it has been dispatched * is done when there is a protocol or an unexpected I/O error with * the underlying TCP channel. * * @param request this is the session initiating request * @param response this is the session initiating response */ public void terminate(Request request, Response response) { Channel channel = request.getChannel(); Trace trace = channel.getTrace(); try { response.close(); channel.close(); trace.trace(TERMINATE_SOCKET); } catch(Exception cause) { trace.trace(ERROR, cause); } } }