public final class ExecutorCaller extends Object implements Caller
Caller implementation that defers all execution to a
ExecutorService.| Constructor and Description |
|---|
ExecutorCaller() |
| Modifier and Type | Method and Description |
|---|---|
void |
execute(Runnable runnable)
Execute the given action.
|
void |
referenceLeaked(Object reference,
StackTraceElement[] stack)
Indicate that a Managed reference has been leaked.
|
public void execute(Runnable runnable)
Callerpublic void referenceLeaked(Object reference, StackTraceElement[] stack)
CallerThis is usually called by end-user code that never releases a managed reference, like this:
public static class Example {
private final Async async;
private final Managed<Database> database;
public Example(final Async async, final Managed<Database> database) {
this.async = async;
this.database = database;
}
public Stage<Void> doSomething() {
return database.doto(database -> {
Completable<Void> stage = async.completable();
return stage;
});
}
}
This leaves the managed database in an open state since its reference count will never go back to zero. When the stage and the corresponding borrowed is garbage collected, it will be reported here.
referenceLeaked in interface Callerreference - the reference that was leakedstack - the stacktrace for where it was leaked, can be null if the information is
unavailableCopyright © 2017. All rights reserved.