CAPTURE_STACK, TRACING
Modifier and Type | Method and Description |
---|---|
Borrowed<T> |
borrow()
Borrow the underlying reference.
|
<R> Stage<R> |
doto(Function<? super T,? extends Stage<R>> action)
Borrow a reference and execute the given action.
|
boolean |
isReady()
If managed reference is started, but not stopping or stopped.
|
static <T> ConcurrentManaged<T> |
newManaged(Async async,
Caller caller,
ManagedOptions options,
Supplier<? extends Stage<T>> setup,
Function<? super T,? extends Stage<Void>> teardown) |
Stage<Void> |
start()
Start the managed reference.
|
Stage<Void> |
stop()
Stop the underlying managed reference.
|
String |
toString() |
public static <T> ConcurrentManaged<T> newManaged(Async async, Caller caller, ManagedOptions options, Supplier<? extends Stage<T>> setup, Function<? super T,? extends Stage<Void>> teardown)
public <R> Stage<R> doto(Function<? super T,? extends Stage<R>> action)
Managed
The reference will be released when the action's stage is finished:
final Managed<Database> m = ...;
return m.doto(db -> {
return db.query(...);
});
public Borrowed<T> borrow()
Managed
This reference must be explicitly released, otherwise the application could leak
reference which will cause Managed.stop()
to misbehave
public boolean isReady()
Managed
Should only be used for diagnostical purposes. Code using references should utilize
stages returned by methods like Managed.start()
and Managed.stop()
to know when there
reference is ready.
public Stage<Void> start()
Managed
public Stage<Void> stop()
Managed
If called multiple times will only A stop call will do the following (in order):
Copyright © 2017. All rights reserved.