org.axonframework.commandhandling.disruptor
Class CommandHandlingEntry

java.lang.Object
  extended by org.axonframework.commandhandling.disruptor.CommandHandlingEntry

public class CommandHandlingEntry
extends Object

DataHolder for the DisruptorCommandBus. The CommandHandlingEntry maintains all information required for or produced by the command handling process.

Since:
2.0
Author:
Allard Buijze

Nested Class Summary
static class CommandHandlingEntry.Factory
          Factory class for CommandHandlingEntry instances.
 
Constructor Summary
CommandHandlingEntry(boolean transactional)
          Initializes the CommandHandlingEntry
 
Method Summary
 Object getAggregateIdentifier()
          Returns the identifier of the aggregate to recover.
 BlacklistDetectingCallback getCallback()
          Returns the CommandCallback instance for the executed command.
 CommandMessage<?> getCommand()
          Returns the CommandMessage to be executed.
 Throwable getExceptionResult()
          Returns the exception that occurred while processing the incoming command, or null if processing did not result in an exception or if execution is not yet finished.
 InterceptorChain getInvocationInterceptorChain()
          Returns the InterceptorChain for the invocation process registered with this entry, or null if none is available.
 int getInvokerId()
          Returns the Identifier of the invoker that is chosen to handle this entry.
 int getPublisherId()
          Returns the Identifier of the publisher that is chosen to handle this entry.
 InterceptorChain getPublisherInterceptorChain()
          Returns the InterceptorChain for the publication process registered with this entry, or null if none is available.
 Object getResult()
          Returns the result of the command's execution, or null if the command is not yet executed or resulted in an exception.
 int getSerializerSegmentId()
          Returns the Segment ID that identifies the serializer thread to process this entry
 DisruptorUnitOfWork getUnitOfWork()
          Returns the UnitOfWork for the command execution.
 boolean isRecoverEntry()
          Indicates whether this entry is a recovery entry.
 void reset(CommandMessage<?> newCommand, CommandHandler newCommandHandler, int newInvokerSegmentId, int newPublisherSegmentId, int newSerializerSegmentId, BlacklistDetectingCallback newCallback, List<CommandHandlerInterceptor> invokerInterceptors, List<CommandHandlerInterceptor> publisherInterceptors)
          Resets this entry, preparing it for use for another command.
 void resetAsRecoverEntry(Object newAggregateIdentifier)
          Resets this entry, preparing it for use as a recovery entry.
 void setExceptionResult(Throwable exceptionResult)
          Registers the exception that occurred while processing the incoming command.
 void setResult(Object result)
          Registers the result of the command's execution, if successful.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandHandlingEntry

public CommandHandlingEntry(boolean transactional)
Initializes the CommandHandlingEntry

Parameters:
transactional - Whether this entry contains transactional Unit of Work
Method Detail

getCommand

public CommandMessage<?> getCommand()
Returns the CommandMessage to be executed.

Returns:
the CommandMessage to be executed

getInvocationInterceptorChain

public InterceptorChain getInvocationInterceptorChain()
Returns the InterceptorChain for the invocation process registered with this entry, or null if none is available.

Returns:
the InterceptorChain for the invocation process registered with this entry

getPublisherInterceptorChain

public InterceptorChain getPublisherInterceptorChain()
Returns the InterceptorChain for the publication process registered with this entry, or null if none is available.

Returns:
the InterceptorChain for the publication process registered with this entry

getUnitOfWork

public DisruptorUnitOfWork getUnitOfWork()
Returns the UnitOfWork for the command execution.

Returns:
the UnitOfWork for the command execution

setExceptionResult

public void setExceptionResult(Throwable exceptionResult)
Registers the exception that occurred while processing the incoming command.

Parameters:
exceptionResult - the exception that occurred while processing the incoming command

getExceptionResult

public Throwable getExceptionResult()
Returns the exception that occurred while processing the incoming command, or null if processing did not result in an exception or if execution is not yet finished.

Returns:
the exception that occurred while processing the incoming command, if any.

setResult

public void setResult(Object result)
Registers the result of the command's execution, if successful.

Parameters:
result - the result of the command's execution, if successful

getResult

public Object getResult()
Returns the result of the command's execution, or null if the command is not yet executed or resulted in an exception.

Returns:
the result of the command's execution, if any

getCallback

public BlacklistDetectingCallback getCallback()
Returns the CommandCallback instance for the executed command.

Returns:
the CommandCallback instance for the executed command

isRecoverEntry

public boolean isRecoverEntry()
Indicates whether this entry is a recovery entry. When true, this entry does not contain any command handling information.

Returns:
true if this entry represents a recovery request, otherwise false.

getAggregateIdentifier

public Object getAggregateIdentifier()
Returns the identifier of the aggregate to recover. Returns null when isRecoverEntry() returns false.

Returns:
the identifier of the aggregate to recover

getInvokerId

public int getInvokerId()
Returns the Identifier of the invoker that is chosen to handle this entry.

Returns:
the Identifier of the invoker that is chosen to handle this entry

getSerializerSegmentId

public int getSerializerSegmentId()
Returns the Segment ID that identifies the serializer thread to process this entry

Returns:
the Segment ID that identifies the serializer thread to process this entry

getPublisherId

public int getPublisherId()
Returns the Identifier of the publisher that is chosen to handle this entry.

Returns:
the Identifier of the publisher that is chosen to handle this entry

reset

public void reset(CommandMessage<?> newCommand,
                  CommandHandler newCommandHandler,
                  int newInvokerSegmentId,
                  int newPublisherSegmentId,
                  int newSerializerSegmentId,
                  BlacklistDetectingCallback newCallback,
                  List<CommandHandlerInterceptor> invokerInterceptors,
                  List<CommandHandlerInterceptor> publisherInterceptors)
Resets this entry, preparing it for use for another command.

Parameters:
newCommand - The new command the entry is used for
newCommandHandler - The Command Handler responsible for handling newCommand
newInvokerSegmentId - The SegmentID of the invoker that should process this entry
newPublisherSegmentId - The SegmentID of the publisher that should process this entry
newSerializerSegmentId - The SegmentID of the serializer that should process this entry
newCallback - The callback to report the result of command execution to
invokerInterceptors - The interceptors to invoke during the command handler invocation phase
publisherInterceptors - The interceptors to invoke during the publication phase

resetAsRecoverEntry

public void resetAsRecoverEntry(Object newAggregateIdentifier)
Resets this entry, preparing it for use as a recovery entry.

Parameters:
newAggregateIdentifier - The identifier of the aggregate to recover


Copyright © 2010-2016. All Rights Reserved.