/** * Migrates this pipeline to a different owner. * The migration logic is rather simple: * <p><ul> * <li>Submit a de-registration task to a current NioThread</li> * <li>The de-registration task submits a registration task to the new NioThread</li> * </ul></p> * * @param newOwner target NioThread this handler migrates to */ @Override public final void requestMigration(NioThread newOwner) { // todo: what happens when owner null. owner.addTaskAndWakeup(new StartMigrationTask(newOwner)); }
/** * Migrates this pipeline to a different owner. * The migration logic is rather simple: * <p><ul> * <li>Submit a de-registration task to a current NioThread</li> * <li>The de-registration task submits a registration task to the new NioThread</li> * </ul></p> * * @param newOwner target NioThread this handler migrates to */ @Override public final void requestMigration(NioThread newOwner) { // todo: what happens when owner null. owner.addTaskAndWakeup(new StartMigrationTask(newOwner)); }
@Override public void run() { for (NioChannel channel : channels) { final NioInboundPipeline inboundPipeline = channel.inboundPipeline; NioThread inputThread = inboundPipeline.owner(); if (inputThread != null) { inputThread.addTaskAndWakeup(new Runnable() { @Override public void run() { inboundPipeline.publishMetrics(); } }); } final NioOutboundPipeline outboundPipeline = channel.outboundPipeline; NioThread outputThread = outboundPipeline.owner(); if (outputThread != null) { outputThread.addTaskAndWakeup(new Runnable() { @Override public void run() { outboundPipeline.publishMetrics(); } }); } } } }
@Override public void run() { for (NioChannel channel : channels) { final NioInboundPipeline inboundPipeline = channel.inboundPipeline; NioThread inputThread = inboundPipeline.owner(); if (inputThread != null) { inputThread.addTaskAndWakeup(new Runnable() { @Override public void run() { inboundPipeline.publishMetrics(); } }); } final NioOutboundPipeline outboundPipeline = channel.outboundPipeline; NioThread outputThread = outboundPipeline.owner(); if (outputThread != null) { outputThread.addTaskAndWakeup(new Runnable() { @Override public void run() { outboundPipeline.publishMetrics(); } }); } } } }
private void restoreTasks(NioThread owner, TaskNode node, boolean wakeup) { if (node == null) { return; } // we restore in the opposite order so that we get fifo. restoreTasks(owner, node.next, false); if (wakeup) { owner.addTaskAndWakeup(node.task); } else { owner.addTask(node.task); } }
private void restoreTasks(NioThread owner, TaskNode node, boolean wakeup) { if (node == null) { return; } // we restore in the opposite order so that we get fifo. restoreTasks(owner, node.next, false); if (wakeup) { owner.addTaskAndWakeup(node.task); } else { owner.addTask(node.task); } }
private void startMigration(final NioThread newOwner) throws IOException { assert owner == currentThread() : "startMigration can only run on the owning NioThread"; assert owner != newOwner : "newOwner can't be the same as the existing owner"; if (!socketChannel.isOpen()) { // if the channel is closed, we are done. return; } startedMigrations.inc(); unregisterOp(initialOps); selectionKey.cancel(); selectionKey = null; owner = null; ownerId = -1; newOwner.addTaskAndWakeup(new CompleteMigrationTask(newOwner)); } }
private void startMigration(final NioThread newOwner) throws IOException { assert owner == currentThread() : "startMigration can only run on the owning NioThread"; assert owner != newOwner : "newOwner can't be the same as the existing owner"; if (!socketChannel.isOpen()) { // if the channel is closed, we are done. return; } startedMigrations.inc(); unregisterOp(initialOps); selectionKey.cancel(); selectionKey = null; owner = null; ownerId = -1; newOwner.addTaskAndWakeup(new CompleteMigrationTask(newOwner)); } }
if (localOwner != null) { localOwner.addTaskAndWakeup(task); return;
if (localOwner != null) { localOwner.addTaskAndWakeup(task); return;