org.axonframework.commandhandling.distributed.jgroups.support.callbacks
Class MemberAwareCommandCallback<R>

java.lang.Object
  extended by org.axonframework.commandhandling.distributed.jgroups.support.callbacks.MemberAwareCommandCallback<R>
Type Parameters:
R - The expected type of return value
All Implemented Interfaces:
CommandCallback<R>

public class MemberAwareCommandCallback<R>
extends Object
implements CommandCallback<R>

Callback implementation which wraps another callback, and is aware of the JGroups node responsible for providing the value to invoke the wrapped callback with.

Since:
2.0
Author:
Allard Buijze

Constructor Summary
MemberAwareCommandCallback(org.jgroups.Address dest, CommandCallback<R> callback)
          Initialize the callback, where the given dest is responsible for providing the value to invoke the given callback with.
 
Method Summary
 boolean isMemberLive(org.jgroups.View view)
          Indicates whether the node responsible for providing the value to invoke the callback with is still alive in the given currentView.
 void onFailure(Throwable cause)
          Invoked when command handling execution resulted in an error.
 void onSuccess(R result)
          Invoked when command handling execution was successful.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemberAwareCommandCallback

public MemberAwareCommandCallback(org.jgroups.Address dest,
                                  CommandCallback<R> callback)
Initialize the callback, where the given dest is responsible for providing the value to invoke the given callback with.

Parameters:
dest - The destination of the command of which the result is to be passed to the callback
callback - The callback to invoke with the result of the command
Method Detail

isMemberLive

public boolean isMemberLive(org.jgroups.View view)
Indicates whether the node responsible for providing the value to invoke the callback with is still alive in the given currentView.

Parameters:
view - The view containing the currently available nodes in the JGroups cluster
Returns:
true if the node is live, otherwise false

onSuccess

public void onSuccess(R result)
Description copied from interface: CommandCallback
Invoked when command handling execution was successful.

Specified by:
onSuccess in interface CommandCallback<R>
Parameters:
result - The result of the command handling execution, if any.

onFailure

public void onFailure(Throwable cause)
Description copied from interface: CommandCallback
Invoked when command handling execution resulted in an error.

Specified by:
onFailure in interface CommandCallback<R>
Parameters:
cause - The exception raised during command handling


Copyright © 2010-2016. All Rights Reserved.