public interface CompletionListener<T>
NonBlockingClient
operations. For example:
NonBlockingClient client = // ... initialization code client.send("/kittens", "Hello kitty!", new CompletionListener() { public void onSuccess(NonBlockingClient c, // c == client Object ctx) { // ... code for handling success of send operation } public void onError(NonBlockingClient c, // c == client Object ctx, ClientCheckedException exception) { // ... code for handing failure of send operation - for example: exception.printStackTrace(); // The reason the operation failed. } }, null); // This value is passed into the listener as the context argument...
Modifier and Type | Method and Description |
---|---|
void |
onError(NonBlockingClient client,
T context,
Exception exception)
Called to indicate that the operation failed.
|
void |
onSuccess(NonBlockingClient client,
T context)
Called to indicate that the operation completed successfully.
|
void onSuccess(NonBlockingClient client, T context)
client
- the client that the listener was registered against.context
- an object that was supplied at the point the listener was
registered. This allows an application to correlate the
invocation of a listener with the point at which the listener
was registered.void onError(NonBlockingClient client, T context, Exception exception)
client
- the client that the listener was registered against.context
- an object that was supplied at the point the listener was
registered. This allows an application to correlate the
invocation of a listener with the point at which the listener
was registered.exception
- an exception that indicates why the operation failed.Copyright © 2015 International Business Machines Corporation. All rights reserved.