com.atlassian.jira.cluster
Class OfBizClusterMessageStore

java.lang.Object
  extended by com.atlassian.jira.cluster.OfBizClusterMessageStore

public class OfBizClusterMessageStore
extends Object

Responsible for storing and retrieving cluster messages in the underlying database.

Since:
v6.1

Field Summary
protected static String CLAIMED_BY_NODE
           
protected static String DESTINATION_NODE
           
protected static String ENTITY
           
protected static String ID
           
protected static String MESSAGE
           
protected static String MESSAGE_TIME
           
protected static String SOURCE_NODE
           
 
Constructor Summary
OfBizClusterMessageStore(OfBizDelegator ofBizDelegator)
           
 
Method Summary
 ClusterMessage createMessage(String sourceNode, String destinationNode, String message)
          Creates a ClusterMessage and stores it in the underlying database
 int deleteMessage(ClusterMessage clusterMessage)
           
 int deleteMessagesBefore(Date before)
           
 Long getLatestMessageByNodeId(String nodeId)
          Get the id of the latest message in the store for a node..
 List<ClusterMessage> getMessages(Node sourceNode, Node destinationNode, Long afterMessageId)
          Retrieves the messages destined for the given node, from a source node.
 org.ofbiz.core.entity.GenericValue storeMessage(ClusterMessage message)
          Stores the message in the underlying database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DESTINATION_NODE

protected static final String DESTINATION_NODE
See Also:
Constant Field Values

ENTITY

protected static final String ENTITY
See Also:
Constant Field Values

ID

protected static final String ID
See Also:
Constant Field Values

MESSAGE

protected static final String MESSAGE
See Also:
Constant Field Values

SOURCE_NODE

protected static final String SOURCE_NODE
See Also:
Constant Field Values

CLAIMED_BY_NODE

protected static final String CLAIMED_BY_NODE
See Also:
Constant Field Values

MESSAGE_TIME

protected static final String MESSAGE_TIME
See Also:
Constant Field Values
Constructor Detail

OfBizClusterMessageStore

public OfBizClusterMessageStore(OfBizDelegator ofBizDelegator)
Method Detail

storeMessage

public org.ofbiz.core.entity.GenericValue storeMessage(@Nonnull
                                                       ClusterMessage message)
Stores the message in the underlying database.

Parameters:
message - - the message to store in the underlying table

createMessage

public ClusterMessage createMessage(@Nonnull
                                    String sourceNode,
                                    @Nonnull
                                    String destinationNode,
                                    @Nonnull
                                    String message)
Creates a ClusterMessage and stores it in the underlying database

Parameters:
sourceNode - the ID of the source node (required)
destinationNode - the ID of the destination node (required)
message - the message to send (required)

getMessages

public List<ClusterMessage> getMessages(Node sourceNode,
                                        Node destinationNode,
                                        Long afterMessageId)
Retrieves the messages destined for the given node, from a source node. Returns messages with either the specific node id, or destined for all, but they must have been sent from another node - no listening to your own messages. We process each source node separately because the message Ids are not monotonically increasing across nodes.

Parameters:
sourceNode - The sending node
destinationNode - The listening node
afterMessageId - Only messages with a higher Message Id than this id will be returned. If starting beyond is null will return all messages for the source destinationNode pair.
Returns:
a non-null list

deleteMessage

public int deleteMessage(ClusterMessage clusterMessage)

getLatestMessageByNodeId

public Long getLatestMessageByNodeId(String nodeId)
Get the id of the latest message in the store for a node.. That is the message with the highest id or null if there are no messages.

Parameters:
nodeId - the id of the node.
Returns:
the id of the latest message in the store.

deleteMessagesBefore

public int deleteMessagesBefore(Date before)


Copyright © 2002-2014 Atlassian. All Rights Reserved.