/** * Get the max idle timeout for new connections. * * @return the max idle timeout in milliseconds for new connections. */ public long getMaxIdleTimeout() { return this.policy.getIdleTimeout(); }
@Override public long getIdleTimeout() { return delegated.getIdleTimeout(); }
/** * Get the max idle timeout for new connections. * * @return the max idle timeout in milliseconds for new connections. */ public long getMaxIdleTimeout() { return this.policy.getIdleTimeout(); }
public WebSocketServerConnection(EndPoint endp, Executor executor, Scheduler scheduler, WebSocketPolicy policy, ByteBufferPool bufferPool, WebSocketServerFactory factory) { super(endp,executor,scheduler,policy,bufferPool); if (policy.getIdleTimeout() > 0) { endp.setIdleTimeout(policy.getIdleTimeout()); } this.factory = factory; }
public WebSocketServerConnection(EndPoint endp, Executor executor, Scheduler scheduler, WebSocketPolicy policy, ByteBufferPool bufferPool) { super(endp,executor,scheduler,policy,bufferPool); if (policy.getIdleTimeout() > 0) { endp.setIdleTimeout(policy.getIdleTimeout()); } }
public WebSocketServerConnection(EndPoint endp, Executor executor, Scheduler scheduler, WebSocketPolicy policy, ByteBufferPool bufferPool, WebSocketServerFactory factory) { super(endp,executor,scheduler,policy,bufferPool); if (policy.getIdleTimeout() > 0) { endp.setIdleTimeout(policy.getIdleTimeout()); } this.factory = factory; }
@Override public long getDefaultMaxSessionIdleTimeout() { return this.configuration.getPolicy().getIdleTimeout(); }
/** * Get the max idle timeout for new connections. * * @return the max idle timeout in milliseconds for new connections. */ public long getMaxIdleTimeout() { return getPolicy().getIdleTimeout(); }
@Override public void start() { scheduledExecutorService.scheduleWithFixedDelay(new Runnable() { @Override public void run() { for (IWebSocketConnection connection: new SimpleWebSocketConnectionRegistry().getConnections(application)) { if (connection.isOpen()) { try { connection.sendMessage(WebSocketManager.KEEP_ALIVE); } catch (IOException e) { throw new RuntimeException(e); } } } } }, 0, webSocketPolicy.getIdleTimeout()/2, TimeUnit.MILLISECONDS); }
@Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append(this.getClass().getSimpleName()); builder.append("@").append(Integer.toHexString(hashCode())); builder.append("[behavior=").append(getBehavior()); builder.append(",maxTextMessageSize=").append(getMaxTextMessageSize()); builder.append(",maxTextMessageBufferSize=").append(getMaxTextMessageBufferSize()); builder.append(",maxBinaryMessageSize=").append(getMaxBinaryMessageSize()); builder.append(",maxBinaryMessageBufferSize=").append(getMaxTextMessageBufferSize()); builder.append(",asyncWriteTimeout=").append(getAsyncWriteTimeout()); builder.append(",idleTimeout=").append(getIdleTimeout()); builder.append(",inputBufferSize=").append(getInputBufferSize()); builder.append("]"); return builder.toString(); }
@Override protected EndPoint newEndPoint(SocketChannel channel, ManagedSelector selectSet, SelectionKey selectionKey) throws IOException { LOG.debug("newEndPoint({}, {}, {})",channel,selectSet,selectionKey); return new SelectChannelEndPoint(channel,selectSet,selectionKey,getScheduler(),policy.getIdleTimeout()); }
@Override protected EndPoint newEndPoint(SocketChannel channel, ManagedSelector selectSet, SelectionKey selectionKey) throws IOException { LOG.debug("newEndPoint({}, {}, {})",channel,selectSet,selectionKey); return new SelectChannelEndPoint(channel,selectSet,selectionKey,getScheduler(),policy.getIdleTimeout()); }
public AbstractWebSocketConnection(EndPoint endp, Executor executor, Scheduler scheduler, WebSocketPolicy policy, ByteBufferPool bufferPool) { super(endp,executor); this.id = Long.toString(ID_GEN.incrementAndGet()); this.policy = policy; this.bufferPool = bufferPool; this.generator = new Generator(policy,bufferPool); this.parser = new Parser(policy,bufferPool); this.scheduler = scheduler; this.extensions = new ArrayList<>(); this.suspendToken = new AtomicBoolean(false); this.ioState = new IOState(); this.ioState.addListener(this); this.flusher = new Flusher(bufferPool,generator,endp); this.setInputBufferSize(policy.getInputBufferSize()); this.setMaxIdleTimeout(policy.getIdleTimeout()); }
/** * Make a copy of the policy, with current values. * @return the cloned copy of the policy. */ public WebSocketPolicy clonePolicy() { WebSocketPolicy clone = new WebSocketPolicy(this.behavior); clone.idleTimeout = this.getIdleTimeout(); clone.maxTextMessageSize = this.getMaxTextMessageSize(); clone.maxTextMessageBufferSize = this.getMaxTextMessageBufferSize(); clone.maxBinaryMessageSize = this.getMaxBinaryMessageSize(); clone.maxBinaryMessageBufferSize = this.getMaxBinaryMessageBufferSize(); clone.inputBufferSize = this.getInputBufferSize() ; clone.asyncWriteTimeout = this.getAsyncWriteTimeout(); return clone; }