CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation

com.tangosol.net.partition
Class PartitionEvent

java.lang.Object
  extended by java.util.EventObject
      extended by com.tangosol.net.partition.PartitionEvent
All Implemented Interfaces:
Serializable

public class PartitionEvent
extends EventObject

The PartitionEvent carries information about an event related to one or more partitions.

Since:
Coherence 3.3
Author:
cp 2007.05.18

Field Summary
protected  Member m_memberFrom
          The "from" member for events that represent transfer from a member.
protected  Member m_memberTo
          The "to" member for events that represent transfer to a member.
protected  int m_nId
          The event's id.
protected  PartitionSet m_setPartitions
          The set of affected partitions.
static int PARTITION_LOST
          This event indicates that a partition has been lost.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
PartitionEvent(PartitionedService svc, int nId, PartitionSet setPartitions, Member memberFrom, Member memberTo)
          Construct a partition event.
 
Method Summary
protected  String getDescription()
          Get the event's description.
static String getDescription(int nId)
          Convert an event ID into a human-readable string.
 Member getFromMember()
          Determine the member that held the partitions prior to the action represented by this event.
 int getId()
          Return this event's id.
 PartitionSet getPartitionSet()
          Determine the set of partitions represented by this event.
 PartitionedService getService()
          Determine the partitioned service that this event originates from.
 Member getToMember()
          Determine the member that holds the partitions after the action represented by this event.
 String toString()
          Return a String representation of this PartitionEvent object.
 
Methods inherited from class java.util.EventObject
getSource
 

Field Detail

PARTITION_LOST

public static final int PARTITION_LOST
This event indicates that a partition has been lost. When a partition has been lost, its ownership re-assigned to a member; in the general case, the owner is the most senior member running the partitioned service. For the PARTITION_LOST event, the partition set and "to member" will always be non-null.

Since:
Coherence 3.3
See Also:
Constant Field Values

m_nId

protected int m_nId
The event's id.


m_setPartitions

protected PartitionSet m_setPartitions
The set of affected partitions.


m_memberFrom

protected Member m_memberFrom
The "from" member for events that represent transfer from a member.


m_memberTo

protected Member m_memberTo
The "to" member for events that represent transfer to a member.

Constructor Detail

PartitionEvent

public PartitionEvent(PartitionedService svc,
                      int nId,
                      PartitionSet setPartitions,
                      Member memberFrom,
                      Member memberTo)
Construct a partition event.

Parameters:
svc - the service raising this event
nId - the event ID, one of the PARTITION_* constants
setPartitions - the set of partitions represented by this event; may be null
memberFrom - the member that held the partitions prior to the action represented by this event; may be null
memberTo - the member that holds the partitions after the action represented by this event; may be null
Method Detail

getService

public PartitionedService getService()
Determine the partitioned service that this event originates from.

Returns:
the originating service

getId

public int getId()
Return this event's id. The event id is one of the PARTITION_* enumerated constants.

It is expected that new event IDs will be added to subsequent versions. Listener implementations that process partition events should only deal with event objects that have specific, known event IDs, and ignore all others.

Returns:
the event id

getPartitionSet

public PartitionSet getPartitionSet()
Determine the set of partitions represented by this event.

Returns:
the PartitionSet containing the partition identifiers represented by this event; may be null

getFromMember

public Member getFromMember()
Determine the member that held the partitions prior to the action represented by this event.

Returns:
the "from" Member for the partitions; may be null

getToMember

public Member getToMember()
Determine the member that holds the partitions after the action represented by this event.

Returns:
the "to" Member for the partitions; may be null

getDescription

protected String getDescription()
Get the event's description.

Returns:
this event's description

getDescription

public static String getDescription(int nId)
Convert an event ID into a human-readable string.

Parameters:
nId - an event ID, one of the PARTITION_* enumerated values
Returns:
a corresponding human-readable string, for example "lost"

toString

public String toString()
Return a String representation of this PartitionEvent object.

Overrides:
toString in class EventObject
Returns:
a human-readable description of the PartitionEvent

CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation