void suspend() { final WorkerThread thread = getWorkerThread(); if (thread == currentThread()) { if (stopped || ! server.resumed) super.suspend(SelectionKey.OP_ACCEPT); } else { thread.execute(new Runnable() { public void run() { suspend(); } }); } }
void initializeTokenCount(final int newCount) { WorkerThread workerThread = getWorkerThread(); final int number = workerThread.getNumber(); if (workerThread == currentThread()) { tokenCount = newCount; if (newCount == 0) { stopped = true; super.suspend(SelectionKey.OP_ACCEPT); } } else { workerThread.execute(new Runnable() { public void run() { server.getHandle(number).initializeTokenCount(newCount); } }); } }
boolean getConnection() { assert currentThread() == getWorkerThread(); if (stopped) { return false; } if (tokenCount != -1 && --tokenCount == 0) { setThreadNewCount(getWorkerThread().getNextThread(), server.getTokenConnectionCount()); } if (++count >= high || tokenCount == 0) { stopped = true; super.suspend(SelectionKey.OP_ACCEPT); } return true; }
void suspend() { final WorkerThread thread = getWorkerThread(); if (thread == currentThread()) { if (stopped || ! server.resumed) super.suspend(SelectionKey.OP_ACCEPT); } else { thread.execute(new Runnable() { public void run() { suspend(); } }); } }
void suspend() { final WorkerThread thread = getWorkerThread(); if (thread == currentThread()) { if (stopped || ! server.resumed) super.suspend(SelectionKey.OP_ACCEPT); } else { thread.execute(new Runnable() { public void run() { suspend(); } }); } }
void initializeTokenCount(final int newCount) { WorkerThread workerThread = getWorkerThread(); final int number = workerThread.getNumber(); if (workerThread == currentThread()) { tokenCount = newCount; if (newCount == 0) { stopped = true; super.suspend(SelectionKey.OP_ACCEPT); } } else { workerThread.execute(new Runnable() { public void run() { server.getHandle(number).initializeTokenCount(newCount); } }); } }
void initializeTokenCount(final int newCount) { WorkerThread workerThread = getWorkerThread(); final int number = workerThread.getNumber(); if (workerThread == currentThread()) { tokenCount = newCount; if (newCount == 0) { stopped = true; super.suspend(SelectionKey.OP_ACCEPT); } } else { workerThread.execute(new Runnable() { public void run() { server.getHandle(number).initializeTokenCount(newCount); } }); } }
boolean getConnection() { assert currentThread() == getWorkerThread(); if (stopped) { return false; } if (tokenCount != -1 && --tokenCount == 0) { setThreadNewCount(getWorkerThread().getNextThread(), server.getTokenConnectionCount()); } if (++count >= high || tokenCount == 0) { stopped = true; super.suspend(SelectionKey.OP_ACCEPT); } return true; }
boolean getConnection() { assert currentThread() == getWorkerThread(); if (stopped) { return false; } if (tokenCount != -1 && --tokenCount == 0) { setThreadNewCount(getWorkerThread().getNextThread(), server.getTokenConnectionCount()); } if (++count >= high || tokenCount == 0) { stopped = true; super.suspend(SelectionKey.OP_ACCEPT); } return true; }