@Override public void run() { if(openConnections >= getHighWater(connectionStatus)) { synchronized (QueuedNioTcpServer.this) { suspendedDueToWatermark = true; tcpServerLog.logf(FQCN, Logger.Level.DEBUG, null, "Total open connections reach high water limit (%s) after updating water mark", getHighWater(connectionStatus)); } } else if(suspendedDueToWatermark && openConnections <= getLowWater(connectionStatus)) { suspendedDueToWatermark = false; } } });
public void wakeupAccepts() { tcpServerLog.logf(FQCN, Logger.Level.TRACE, null, "Wake up accepts on %s", this); resumeAccepts(); handle.wakeup(SelectionKey.OP_ACCEPT); }
public void wakeupAccepts() { tcpServerLog.logf(FQCN, Logger.Level.TRACE, null, "Wake up accepts on %s", this); resumeAccepts(); final NioTcpServerHandle[] handles = this.handles; final int idx = IoUtils.getThreadLocalRandom().nextInt(handles.length); handles[idx].wakeup(SelectionKey.OP_ACCEPT); }
final SelectableChannel channel = key.channel(); if (currentThread() == this) { log.logf(FQCN, Logger.Level.TRACE, null, "Cancelling key %s of %s (same thread)", key, channel); try { key.cancel(); log.logf(FQCN, Logger.Level.TRACE, t, "Error cancelling key %s of %s (same thread)", key, channel); log.logf(FQCN, Logger.Level.TRACE, null, "Cancelling key %s of %s (same thread, old locking)", key, channel); final SynchTask task = new SynchTask(); queueTask(task); key.cancel(); } catch (Throwable t) { log.logf(FQCN, Logger.Level.TRACE, t, "Error cancelling key %s of %s (same thread, old locking)", key, channel); } finally { task.done(); log.logf(FQCN, Logger.Level.TRACE, null, "Cancelling key %s of %s (other thread)", key, channel); try { key.cancel(); log.logf(FQCN, Logger.Level.TRACE, t, "Error cancelling key %s of %s (other thread)", key, channel);
accepted = channel.accept(); if(suspendedDueToWatermark) { tcpServerLog.logf(FQCN, Logger.Level.DEBUG, null, "Exceeding connection high water limit (%s). Closing this new accepting request %s", getHighWater(connectionStatus), accepted); IoUtils.safeClose(accepted); return; tcpServerLog.logf(FQCN, Logger.Level.DEBUG, e, "Exception accepting request, closing server channel %s", this); IoUtils.safeClose(channel); return; synchronized (QueuedNioTcpServer.this) { suspendedDueToWatermark = true; tcpServerLog.logf(FQCN, Logger.Level.DEBUG, null, "Total open connections reach high water limit (%s) by this new accepting request %s", getHighWater(connectionStatus), accepted);
@Override public void run() { if(openConnections >= getHighWater(connectionStatus)) { synchronized (QueuedNioTcpServer.this) { suspendedDueToWatermark = true; tcpServerLog.logf(FQCN, Logger.Level.DEBUG, null, "Total open connections reach high water limit (%s) after updating water mark", getHighWater(connectionStatus)); } } else if(suspendedDueToWatermark && openConnections <= getLowWater(connectionStatus)) { suspendedDueToWatermark = false; } } });
@Override public void run() { if(openConnections >= getHighWater(connectionStatus)) { synchronized (QueuedNioTcpServer.this) { suspendedDueToWatermark = true; tcpServerLog.logf(FQCN, Logger.Level.DEBUG, null, "Total open connections reach high water limit (%s) after updating water mark", getHighWater(connectionStatus)); } } else if(suspendedDueToWatermark && openConnections <= getLowWater(connectionStatus)) { suspendedDueToWatermark = false; } } });
public void wakeupAccepts() { tcpServerLog.logf(FQCN, Logger.Level.TRACE, null, "Wake up accepts on %s", this); resumeAccepts(); handle.wakeup(SelectionKey.OP_ACCEPT); }
public void wakeupAccepts() { tcpServerLog.logf(FQCN, Logger.Level.TRACE, null, "Wake up accepts on %s", this); resumeAccepts(); handle.wakeup(SelectionKey.OP_ACCEPT); }
public void wakeupAccepts() { tcpServerLog.logf(FQCN, Logger.Level.TRACE, null, "Wake up accepts on %s", this); resumeAccepts(); final NioTcpServerHandle[] handles = this.handles; final int idx = IoUtils.getThreadLocalRandom().nextInt(handles.length); handles[idx].wakeup(SelectionKey.OP_ACCEPT); }
public void wakeupAccepts() { tcpServerLog.logf(FQCN, Logger.Level.TRACE, null, "Wake up accepts on %s", this); resumeAccepts(); final NioTcpServerHandle[] handles = this.handles; final int idx = IoUtils.getThreadLocalRandom().nextInt(handles.length); handles[idx].wakeup(SelectionKey.OP_ACCEPT); }
final SelectableChannel channel = key.channel(); if (currentThread() == this) { log.logf(FQCN, Logger.Level.TRACE, null, "Cancelling key %s of %s (same thread)", key, channel); try { key.cancel(); log.logf(FQCN, Logger.Level.TRACE, t, "Error cancelling key %s of %s (same thread)", key, channel); log.logf(FQCN, Logger.Level.TRACE, null, "Cancelling key %s of %s (same thread, old locking)", key, channel); final SynchTask task = new SynchTask(); queueTask(task); key.cancel(); } catch (Throwable t) { log.logf(FQCN, Logger.Level.TRACE, t, "Error cancelling key %s of %s (same thread, old locking)", key, channel); } finally { task.done(); log.logf(FQCN, Logger.Level.TRACE, null, "Cancelling key %s of %s (other thread)", key, channel); try { key.cancel(); log.logf(FQCN, Logger.Level.TRACE, t, "Error cancelling key %s of %s (other thread)", key, channel);
final SelectableChannel channel = key.channel(); if (currentThread() == this) { log.logf(FQCN, Logger.Level.TRACE, null, "Cancelling key %s of %s (same thread)", key, channel); try { key.cancel(); log.logf(FQCN, Logger.Level.TRACE, t, "Error cancelling key %s of %s (same thread)", key, channel); log.logf(FQCN, Logger.Level.TRACE, null, "Cancelling key %s of %s (same thread, old locking)", key, channel); final SynchTask task = new SynchTask(); queueTask(task); key.cancel(); } catch (Throwable t) { log.logf(FQCN, Logger.Level.TRACE, t, "Error cancelling key %s of %s (same thread, old locking)", key, channel); } finally { task.done(); log.logf(FQCN, Logger.Level.TRACE, null, "Cancelling key %s of %s (other thread)", key, channel); try { key.cancel(); log.logf(FQCN, Logger.Level.TRACE, t, "Error cancelling key %s of %s (other thread)", key, channel);
accepted = channel.accept(); if(suspendedDueToWatermark) { tcpServerLog.logf(FQCN, Logger.Level.DEBUG, null, "Exceeding connection high water limit (%s). Closing this new accepting request %s", getHighWater(connectionStatus), accepted); IoUtils.safeClose(accepted); return; tcpServerLog.logf(FQCN, Logger.Level.DEBUG, e, "Exception accepting request, closing server channel %s", this); IoUtils.safeClose(channel); return; synchronized (QueuedNioTcpServer.this) { suspendedDueToWatermark = true; tcpServerLog.logf(FQCN, Logger.Level.DEBUG, null, "Total open connections reach high water limit (%s) by this new accepting request %s", getHighWater(connectionStatus), accepted);
accepted = channel.accept(); if(suspendedDueToWatermark) { tcpServerLog.logf(FQCN, Logger.Level.DEBUG, null, "Exceeding connection high water limit (%s). Closing this new accepting request %s", getHighWater(connectionStatus), accepted); IoUtils.safeClose(accepted); return; tcpServerLog.logf(FQCN, Logger.Level.DEBUG, e, "Exception accepting request, closing server channel %s", this); IoUtils.safeClose(channel); return; synchronized (QueuedNioTcpServer.this) { suspendedDueToWatermark = true; tcpServerLog.logf(FQCN, Logger.Level.DEBUG, null, "Total open connections reach high water limit (%s) by this new accepting request %s", getHighWater(connectionStatus), accepted);