/** * Delivers this event to the next filter. */ public void deliverEvent() { logger.debug("Delivering event {}", this); deliverEvent(this.nextFilter, this.session, this.type, this.status); }
/** * Event is stored in an {@link IoSessionEventQueue} for later delivery to the next filter * in the chain when the handshake would have succeed. This will prevent the rest of * the filter chain from being affected by this filter internals. * * @param nextFilter the next filter in filter chain * @param session the session object */ @Override public void sessionOpened(NextFilter nextFilter, IoSession session) throws Exception { ProxyIoSession proxyIoSession = (ProxyIoSession) session.getAttribute(ProxyIoSession.PROXY_SESSION); proxyIoSession.getEventQueue().enqueueEventIfNecessary( new IoSessionEvent(nextFilter, session, IoSessionEventType.OPENED)); }
evt.deliverEvent(); evt.deliverEvent(); } else { if (evt.getType() == IoSessionEventType.CLOSED) { if (proxyIoSession.isAuthenticationFailed()) { proxyIoSession.getConnector().cancelConnectFuture(); discardSessionQueueEvents(); evt.deliverEvent(); } else { discardSessionQueueEvents(); } else if (evt.getType() == IoSessionEventType.OPENED) { enqueueSessionEvent(evt); evt.deliverEvent(); } else { enqueueSessionEvent(evt);
/** * Signals that the handshake has finished. */ protected final void setHandshakeComplete() { synchronized (this) { handshakeComplete = true; } ProxyIoSession proxyIoSession = getProxyIoSession(); proxyIoSession.getConnector().fireConnected(proxyIoSession.getSession()).awaitUninterruptibly(); LOGGER.debug(" handshake completed"); // Connected OK try { proxyIoSession.getEventQueue().flushPendingSessionEvents(); flushPendingWriteRequests(); } catch (Exception ex) { LOGGER.error("Unable to flush pending write requests", ex); } }
evt.deliverEvent(); evt.deliverEvent(); } else { if (evt.getType() == IoSessionEventType.CLOSED) { if (proxyIoSession.isAuthenticationFailed()) { proxyIoSession.getConnector().cancelConnectFuture(); discardSessionQueueEvents(); evt.deliverEvent(); } else { discardSessionQueueEvents(); } else if (evt.getType() == IoSessionEventType.OPENED) { enqueueSessionEvent(evt); evt.deliverEvent(); } else { enqueueSessionEvent(evt);
/** * Event is stored in an {@link IoSessionEventQueue} for later delivery to the next filter * in the chain when the handshake would have succeed. This will prevent the rest of * the filter chain from being affected by this filter internals. * * @param nextFilter the next filter in filter chain * @param session the session object */ @Override public void sessionIdle(NextFilter nextFilter, IoSession session, IdleStatus status) throws Exception { ProxyIoSession proxyIoSession = (ProxyIoSession) session.getAttribute(ProxyIoSession.PROXY_SESSION); proxyIoSession.getEventQueue().enqueueEventIfNecessary(new IoSessionEvent(nextFilter, session, status)); }
/** * Delivers this event to the next filter. */ public void deliverEvent() { logger.debug("Delivering event {}", this); deliverEvent(this.nextFilter, this.session, this.type, this.status); }
/** * Signals that the handshake has finished. */ protected final void setHandshakeComplete() { synchronized (this) { handshakeComplete = true; } ProxyIoSession proxyIoSession = getProxyIoSession(); proxyIoSession.getConnector().fireConnected(proxyIoSession.getSession()).awaitUninterruptibly(); LOGGER.debug(" handshake completed"); // Connected OK try { proxyIoSession.getEventQueue().flushPendingSessionEvents(); flushPendingWriteRequests(); } catch (Exception ex) { LOGGER.error("Unable to flush pending write requests", ex); } }
evt.deliverEvent(); return; evt.deliverEvent(); } else { if (evt.getType() == IoSessionEventType.CLOSED) { if (proxyIoSession.isAuthenticationFailed()) { proxyIoSession.getConnector().cancelConnectFuture(); discardSessionQueueEvents(); evt.deliverEvent(); } else { discardSessionQueueEvents(); } else if (evt.getType() == IoSessionEventType.OPENED) { enqueueSessionEvent(evt); evt.deliverEvent(); } else { enqueueSessionEvent(evt);
/** * Event is stored in an {@link IoSessionEventQueue} for later delivery to the next filter * in the chain when the handshake would have succeed. This will prevent the rest of * the filter chain from being affected by this filter internals. * * @param nextFilter the next filter in filter chain * @param session the session object */ @Override public void sessionIdle(NextFilter nextFilter, IoSession session, IdleStatus status) throws Exception { ProxyIoSession proxyIoSession = (ProxyIoSession) session.getAttribute(ProxyIoSession.PROXY_SESSION); proxyIoSession.getEventQueue().enqueueEventIfNecessary(new IoSessionEvent(nextFilter, session, status)); }
/** * Delivers this event to the next filter. */ public void deliverEvent() { logger.debug("Delivering event {}", this); deliverEvent(this.nextFilter, this.session, this.type, this.status); }
/** * Event is stored in an {@link IoSessionEventQueue} for later delivery to the next filter * in the chain when the handshake would have succeed. This will prevent the rest of * the filter chain from being affected by this filter internals. * * @param nextFilter the next filter in filter chain * @param session the session object */ @Override public void sessionClosed(NextFilter nextFilter, IoSession session) throws Exception { ProxyIoSession proxyIoSession = (ProxyIoSession) session.getAttribute(ProxyIoSession.PROXY_SESSION); proxyIoSession.getEventQueue().enqueueEventIfNecessary( new IoSessionEvent(nextFilter, session, IoSessionEventType.CLOSED)); } }
/** * Send any session event which were queued while waiting for handshaking to complete. * * Please note this is an internal method. DO NOT USE it in your code. */ public void flushPendingSessionEvents() throws Exception { synchronized (sessionEventsQueue) { IoSessionEvent evt; while ((evt = sessionEventsQueue.poll()) != null) { logger.debug(" Flushing buffered event: {}", evt); evt.deliverEvent(); } } }
/** * Event is stored in an {@link IoSessionEventQueue} for later delivery to the next filter * in the chain when the handshake would have succeed. This will prevent the rest of * the filter chain from being affected by this filter internals. * * @param nextFilter the next filter in filter chain * @param session the session object */ @Override public void sessionOpened(NextFilter nextFilter, IoSession session) throws Exception { ProxyIoSession proxyIoSession = (ProxyIoSession) session.getAttribute(ProxyIoSession.PROXY_SESSION); proxyIoSession.getEventQueue().enqueueEventIfNecessary( new IoSessionEvent(nextFilter, session, IoSessionEventType.OPENED)); }
/** * Send any session event which were queued while waiting for handshaking to complete. * * Please note this is an internal method. DO NOT USE it in your code. * * @throws Exception If something went wrong while flushing the pending events */ public void flushPendingSessionEvents() throws Exception { synchronized (sessionEventsQueue) { IoSessionEvent evt; while ((evt = sessionEventsQueue.poll()) != null) { logger.debug(" Flushing buffered event: {}", evt); evt.deliverEvent(); } } }
/** * Event is stored in an {@link IoSessionEventQueue} for later delivery to the next filter * in the chain when the handshake would have succeed. This will prevent the rest of * the filter chain from being affected by this filter internals. * * @param nextFilter the next filter in filter chain * @param session the session object */ @Override public void sessionClosed(NextFilter nextFilter, IoSession session) throws Exception { ProxyIoSession proxyIoSession = (ProxyIoSession) session.getAttribute(ProxyIoSession.PROXY_SESSION); proxyIoSession.getEventQueue().enqueueEventIfNecessary( new IoSessionEvent(nextFilter, session, IoSessionEventType.CLOSED)); } }
/** * Send any session event which were queued while waiting for handshaking to complete. * * Please note this is an internal method. DO NOT USE it in your code. * * @throws Exception If something went wrong while flushing the pending events */ public void flushPendingSessionEvents() throws Exception { synchronized (sessionEventsQueue) { IoSessionEvent evt; while ((evt = sessionEventsQueue.poll()) != null) { logger.debug(" Flushing buffered event: {}", evt); evt.deliverEvent(); } } }
/** * Event is stored in an {@link IoSessionEventQueue} for later delivery to the next filter * in the chain when the handshake would have succeed. This will prevent the rest of * the filter chain from being affected by this filter internals. * * @param nextFilter the next filter in filter chain * @param session the session object */ @Override public void sessionIdle(NextFilter nextFilter, IoSession session, IdleStatus status) throws Exception { ProxyIoSession proxyIoSession = (ProxyIoSession) session .getAttribute(ProxyIoSession.PROXY_SESSION); proxyIoSession.getEventQueue().enqueueEventIfNecessary( new IoSessionEvent(nextFilter, session, status)); }
/** * Event is stored in an {@link IoSessionEventQueue} for later delivery to the next filter * in the chain when the handshake would have succeed. This will prevent the rest of * the filter chain from being affected by this filter internals. * * @param nextFilter the next filter in filter chain * @param session the session object */ @Override public void sessionClosed(NextFilter nextFilter, IoSession session) throws Exception { ProxyIoSession proxyIoSession = (ProxyIoSession) session .getAttribute(ProxyIoSession.PROXY_SESSION); proxyIoSession.getEventQueue().enqueueEventIfNecessary( new IoSessionEvent(nextFilter, session, IoSessionEventType.CLOSED)); } }
/** * Event is stored in an {@link IoSessionEventQueue} for later delivery to the next filter * in the chain when the handshake would have succeed. This will prevent the rest of * the filter chain from being affected by this filter internals. * * @param nextFilter the next filter in filter chain * @param session the session object */ @Override public void sessionOpened(NextFilter nextFilter, IoSession session) throws Exception { ProxyIoSession proxyIoSession = (ProxyIoSession) session .getAttribute(ProxyIoSession.PROXY_SESSION); proxyIoSession.getEventQueue().enqueueEventIfNecessary( new IoSessionEvent(nextFilter, session, IoSessionEventType.OPENED)); }