public class CallbackUtils extends Object
Constructor and Description |
---|
CallbackUtils() |
Modifier and Type | Method and Description |
---|---|
static <T> Callback<Void> |
curry(Callback<T> cb,
T result)
Return a Callback
|
static Callback<Void> |
logger(org.slf4j.Logger logger,
String successMsg,
String failureMsg)
Logs what happened (no continuation).
|
static <T> Callback<T> |
logger(org.slf4j.Logger logger,
String successMsg,
String failureMsg,
Callback<T> cont)
Logs what happened before continuing the callback chain.
|
static Callback<Void> |
multiCallback(int expected,
Callback<Void> cb,
Object ctx)
A callback that waits for all of a number of events to fire.
|
static Callback<Void> |
multiCallback(int expected,
Callback<Void> cb,
Object ctx,
org.slf4j.Logger logger,
String successMsg,
String failureMsg,
Runnable eagerErrorHandler)
A callback that waits for all of a number of events to fire.
|
static Callback<Void> |
multinCallback(int expected,
Callback<Void> cb,
Object ctx,
Runnable eagerErrorHandler)
A callback that waits for all of a number of events to fire.
|
static Callback<Void> |
nop()
A do-nothing callback.
|
public static Callback<Void> multiCallback(int expected, Callback<Void> cb, Object ctx, org.slf4j.Logger logger, String successMsg, String failureMsg, Runnable eagerErrorHandler)
expected
- Number of expected callbacks.cb
- The final callback to call.ctx
- logger
- May be null.successMsg
- If not null, then this is logged on success.failureMsg
- If not null, then this is logged on failure.eagerErrorHandler
- If not null, then this will be executed after the first
failure (but before the final failure callback). Useful for
releasing resources, etc. as soon as we know the composite
operation is doomed.public static Callback<Void> multiCallback(int expected, Callback<Void> cb, Object ctx)
public static Callback<Void> multinCallback(int expected, Callback<Void> cb, Object ctx, Runnable eagerErrorHandler)
public static <T> Callback<T> logger(org.slf4j.Logger logger, String successMsg, String failureMsg, Callback<T> cont)
public static Callback<Void> logger(org.slf4j.Logger logger, String successMsg, String failureMsg)
Copyright © 2011-2014 The Apache Software Foundation. All Rights Reserved.