@Override public void onClose() { super.onClose(); this.getIOState().setState(ConnectionState.CLOSED); }
@Override public void onClose() { super.onClose(); this.getIOState().setState(ConnectionState.CLOSED); }
@Override public boolean isOpen() { return getIOState().isOpen() && getEndPoint().isOpen(); }
@Override public boolean isOpen() { return getIOState().isOpen() && getEndPoint().isOpen(); }
@Override protected boolean onReadTimeout() { LOG.warn("Read Timeout"); IOState state = getIOState(); if ((state.getState() == ConnectionState.CLOSING) || (state.getState() == ConnectionState.CLOSED)) { // close already initiated, extra timeouts not relevant // allow udnerlying connection and endpoint to disconnect on its own return true; } // Initiate close - politely send close frame. // Note: it is not possible in 100% of cases during read timeout to send this close frame. session.close(StatusCode.NORMAL,"Idle Timeout"); return false; }
@Override protected boolean onReadTimeout() { LOG.warn("Read Timeout"); IOState state = getIOState(); if ((state.getState() == ConnectionState.CLOSING) || (state.getState() == ConnectionState.CLOSED)) { // close already initiated, extra timeouts not relevant // allow udnerlying connection and endpoint to disconnect on its own return true; } // Initiate close - politely send close frame. // Note: it is not possible in 100% of cases during read timeout to send this close frame. session.close(StatusCode.NORMAL,"Idle Timeout"); return false; }
/** * Event for no activity on connection (read or write) * @return true to signal that the endpoint must be closed, false to keep the endpoint open */ @Override protected boolean onReadTimeout(Throwable timeout) { IOState state = getIOState(); ConnectionState cstate = state.getConnectionState(); if (LOG.isDebugEnabled()) LOG.debug("{} Read Timeout - {}",policy.getBehavior(),cstate); if (cstate == ConnectionState.CLOSED) { if (LOG.isDebugEnabled()) LOG.debug("onReadTimeout - Connection Already CLOSED"); // close already completed, extra timeouts not relevant // allow underlying connection and endpoint to disconnect on its own return true; } try { notifyError(timeout); } finally { // This is an Abnormal Close condition session.close(StatusCode.SHUTDOWN,"Idle Timeout"); } return false; }