org.jboss.cache.commands.write
Class InvalidateCommand

java.lang.Object
  extended by org.jboss.cache.commands.read.AbstractDataCommand
      extended by org.jboss.cache.commands.write.InvalidateCommand
All Implemented Interfaces:
DataCommand, ReplicableCommand, VisitableCommand
Direct Known Subclasses:
VersionedInvalidateCommand

public class InvalidateCommand
extends AbstractDataCommand

Removes a node's content from memory - never removes the node. It also clenups data for resident nodes - which are not being touched by eviction.

Since:
2.2
Author:
Mircea.Markus@jboss.com

Field Summary
static int METHOD_ID
           
protected  Notifier notifier
           
protected  CacheSPI spi
           
 
Fields inherited from class org.jboss.cache.commands.read.AbstractDataCommand
dataContainer, fqn
 
Constructor Summary
InvalidateCommand()
           
InvalidateCommand(Fqn fqn)
           
 
Method Summary
 Object acceptVisitor(InvocationContext ctx, Visitor visitor)
          Accept a visitor, and return the result of accepting this visitor.
protected  NodeSPI enforceNodeLoading()
          //TODO: 2.2.0: rather than using CacheSPI this should use peek().
 int getCommandId()
          Used by marshallers to convert this command into an id for streaming.
 Object[] getParameters()
          Basic versions of these methods
 void initialize(CacheSPI cacheSpi, DataContainer dataContainer, Notifier notifier)
           
protected  void invalidateNode(NodeSPI node)
          mark the node to be removed (and all children) as invalid so anyone holding a direct reference to it will be aware that it is no longer valid.
 Object perform(InvocationContext ctx)
          Performs an invalidation on a specified node
 void setParameters(int commandId, Object[] args)
          Basic versions of these methods
 String toString()
           
 
Methods inherited from class org.jboss.cache.commands.read.AbstractDataCommand
equals, getFqn, hashCode, initialize
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

METHOD_ID

public static final int METHOD_ID
See Also:
Constant Field Values

spi

protected CacheSPI spi

notifier

protected Notifier notifier
Constructor Detail

InvalidateCommand

public InvalidateCommand(Fqn fqn)

InvalidateCommand

public InvalidateCommand()
Method Detail

initialize

public void initialize(CacheSPI cacheSpi,
                       DataContainer dataContainer,
                       Notifier notifier)

perform

public Object perform(InvocationContext ctx)
Performs an invalidation on a specified node

Parameters:
ctx - invocation context
Returns:
null

enforceNodeLoading

protected NodeSPI enforceNodeLoading()
//TODO: 2.2.0: rather than using CacheSPI this should use peek(). The other interceptors should obtain locks and load nodes if necessary for this InvalidateCommand. //Even better - this can be handles in the interceptors before call interceptor


invalidateNode

protected void invalidateNode(NodeSPI node)
mark the node to be removed (and all children) as invalid so anyone holding a direct reference to it will be aware that it is no longer valid.


acceptVisitor

public Object acceptVisitor(InvocationContext ctx,
                            Visitor visitor)
                     throws Throwable
Description copied from interface: VisitableCommand
Accept a visitor, and return the result of accepting this visitor.

Parameters:
ctx - invocation context
visitor - visitor to accept
Returns:
arbitrary return value
Throws:
Throwable - in the event of problems

getCommandId

public int getCommandId()
Description copied from interface: ReplicableCommand
Used by marshallers to convert this command into an id for streaming.

Returns:
the method id of this command. This is compatible with pre-2.2.0 MethodCall ids.

toString

public String toString()
Overrides:
toString in class AbstractDataCommand

getParameters

public Object[] getParameters()
Description copied from class: AbstractDataCommand
Basic versions of these methods

Specified by:
getParameters in interface ReplicableCommand
Overrides:
getParameters in class AbstractDataCommand
Returns:
an object array of arguments, compatible with pre-2.2.0 MethodCall args.

setParameters

public void setParameters(int commandId,
                          Object[] args)
Description copied from class: AbstractDataCommand
Basic versions of these methods

Specified by:
setParameters in interface ReplicableCommand
Overrides:
setParameters in class AbstractDataCommand
Parameters:
commandId - command id to set. This is usually unused but *could* be used in the event of a command having multiple IDs, such as PutKeyValueCommand.
args - object array of args


Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.