Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
806 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,61 @@ | |||
/* | |||
* Copyright (c) 2011-2013 The original author or authors | |||
* ------------------------------------------------------ | |||
* All rights reserved. This program and the accompanying materials | |||
* are made available under the terms of the Eclipse Public License v1.0 | |||
* and Apache License v2.0 which accompanies this distribution. | |||
* | |||
* The Eclipse Public License is available at | |||
* http://www.eclipse.org/legal/epl-v10.html | |||
* | |||
* The Apache License v2.0 is available at | |||
* http://www.opensource.org/licenses/apache2.0.php | |||
* | |||
* You may elect to redistribute this code under either of these licenses. | |||
*/ | |||
|
|||
package io.vertx.core; | |||
|
|||
import io.vertx.codegen.annotations.VertxGen; | |||
|
|||
/** | |||
* @author <a href="mailto:julien@julienviet.com">Julien Viet</a> | |||
*/ | |||
@VertxGen | |||
public interface WorkerExecutor { | |||
|
|||
/** | |||
* Safely execute some blocking code. | |||
* <p> | |||
* Executes the blocking code in the handler {@code blockingCodeHandler} using a thread from the worker pool. | |||
* <p> | |||
* When the code is complete the handler {@code resultHandler} will be called with the result on the original context | |||
* (e.g. on the original event loop of the caller). | |||
* <p> | |||
* A {@code Future} instance is passed into {@code blockingCodeHandler}. When the blocking code successfully completes, | |||
* the handler should call the {@link Future#complete} or {@link Future#complete(Object)} method, or the {@link Future#fail} | |||
* method if it failed. | |||
* <p> | |||
* In the {@code blockingCodeHandler} the current context remains the original context and therefore any task | |||
* scheduled in the {@code blockingCodeHandler} will be executed on the this context and not on the worker thread. | |||
* | |||
* @param blockingCodeHandler handler representing the blocking code to run | |||
* @param resultHandler handler that will be called when the blocking code is complete | |||
* @param ordered if true then if executeBlocking is called several times on the same context, the executions | |||
* for that context will be executed serially, not in parallel. if false then they will be no ordering | |||
* guarantees | |||
* @param <T> the type of the result | |||
*/ | |||
<T> void executeBlocking(Handler<Future<T>> blockingCodeHandler, boolean ordered, Handler<AsyncResult<T>> resultHandler); | |||
|
|||
/** | |||
* Like {@link #executeBlocking(Handler, boolean, Handler)} called with ordered = true. | |||
*/ | |||
<T> void executeBlocking(Handler<Future<T>> blockingCodeHandler, Handler<AsyncResult<T>> resultHandler); | |||
|
|||
/** | |||
* Close the executor. | |||
*/ | |||
void close(); | |||
|
|||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.