mirrormap.commands
Class AddCommand

java.lang.Object
  extended by mirrormap.commands.AbstractCommand
      extended by mirrormap.commands.AddCommand
All Implemented Interfaces:
Serializable, ICommand
Direct Known Subclasses:
UpdateCommand

public class AddCommand
extends AbstractCommand

Encapsulates a command to put a key-value entry into a MirrorMap.

Author:
Ramon Servadei
See Also:
Serialized Form

Field Summary
protected  Serializable value
          The value the command applies to
 
Fields inherited from class mirrormap.commands.AbstractCommand
key, mirrorMapName
 
Constructor Summary
AddCommand()
           
AddCommand(String mirrorMapName, Serializable key, Serializable value)
           
 
Method Summary
 void execute()
          Execute the command
protected  boolean shouldExecute(MirrorMap<Serializable,Serializable> mirrorMap)
          Determines whether the command should be executed.
 
Methods inherited from class mirrormap.commands.AbstractCommand
getBytes, getMirrorMapName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

value

protected Serializable value
The value the command applies to

Constructor Detail

AddCommand

public AddCommand()

AddCommand

public AddCommand(String mirrorMapName,
                  Serializable key,
                  Serializable value)
Method Detail

execute

public final void execute()
Description copied from interface: ICommand
Execute the command


shouldExecute

protected boolean shouldExecute(MirrorMap<Serializable,Serializable> mirrorMap)
Determines whether the command should be executed. This exists to prevent the source of a change from re-applying it when it receives the same change back from the mirror map server (all peers receive the same change, even the originating one)

Parameters:
mirrorMap - the mirror map affected
Returns:
true if this command should be executed


Copyright © 2010. All Rights Reserved.