GemFire 5.5.1

com.gemstone.gemfire.cache
Class MembershipAttributes

java.lang.Object
  extended by com.gemstone.gemfire.cache.MembershipAttributes
All Implemented Interfaces:
DataSerializable, Externalizable, Serializable

public class MembershipAttributes
extends Object
implements DataSerializable, Externalizable

Configuration attributes for defining reliability requirements and behavior for a Region.

MembershipAttributes provides options for configuring a Region to require one or more membership roles to be present in the system for reliable access to the Region. Each Role is a user defined string name, such as Producer or Backup or FooProducer.

The LossAction defines the behavior when one or more required roles are missing.

The ResumptionAction specifies the action to be taken when reliability resumes.

MembershipAttributes have no effect unless one or more required roles are specified. These attributes are immutable after the Region has been created.

Since:
5.0
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.gemstone.gemfire.DataSerializable
DataSerializable.Replaceable
 
Constructor Summary
MembershipAttributes()
          Creates a new MembershipAttributes with the default configuration of no required roles.
MembershipAttributes(String[] requiredRoles)
          Creates a new MembershipAttributes with the specified required role names.
MembershipAttributes(String[] requiredRoles, LossAction lossAction, ResumptionAction resumptionAction)
          Creates a new MembershipAttributes with the specified required role names, reliability policy, and resumption action.
 
Method Summary
 boolean equals(Object other)
          Indicates whether some other object is "equal to" this one.
 void fromData(DataInput in)
          Reads the state of this object as primitive data from the given DataInput.
 LossAction getLossAction()
          Returns the reliability policy that describes behavior if any required roles are missing.
 Set getRequiredRoles()
          Returns the set of Roles that are required for the reliability of this region.
 ResumptionAction getResumptionAction()
          Returns the resumption action that describes behavior when
 int hashCode()
          Returns a hash code for the object.
 boolean hasRequiredRoles()
          Returns true if there are one or more required roles specified.
 void readExternal(ObjectInput in)
           
 void toData(DataOutput out)
          Writes the state of this object as primitive data to the given DataOutput.
 String toString()
          Returns a string representation of the object.
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MembershipAttributes

public MembershipAttributes()
Creates a new MembershipAttributes with the default configuration of no required roles.


MembershipAttributes

public MembershipAttributes(String[] requiredRoles)
Creates a new MembershipAttributes with the specified required role names. Reliability policy will default to NO_ACCESS, and resumption action will default to REINITIALIZE.

Parameters:
requiredRoles - array of role names required by this process for reliable access to the region
Throws:
IllegalArgumentException - if no requiredRoles are specified

MembershipAttributes

public MembershipAttributes(String[] requiredRoles,
                            LossAction lossAction,
                            ResumptionAction resumptionAction)
Creates a new MembershipAttributes with the specified required role names, reliability policy, and resumption action.

Parameters:
requiredRoles - array of role names required by this process for reliable access to the region
lossAction - the configuration defining how this process behaves when there are missing required roles
resumptionAction - the action to take when missing required roles return to the system
Throws:
IllegalArgumentException - if the resumptionAction is incompatible with the lossAction or if no requiredRoles are specified
Method Detail

getRequiredRoles

public Set getRequiredRoles()
Returns the set of Roles that are required for the reliability of this region.


hasRequiredRoles

public boolean hasRequiredRoles()
Returns true if there are one or more required roles specified.


getLossAction

public LossAction getLossAction()
Returns the reliability policy that describes behavior if any required roles are missing.


getResumptionAction

public ResumptionAction getResumptionAction()
Returns the resumption action that describes behavior when


equals

public boolean equals(Object other)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class Object
Parameters:
other - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

hashCode

public int hashCode()
Returns a hash code for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.

Overrides:
hashCode in class Object
Returns:
the integer 0 if description is null; otherwise a unique integer.

toString

public String toString()
Returns a string representation of the object.

Overrides:
toString in class Object
Returns:
a string representation of the object

toData

public void toData(DataOutput out)
            throws IOException
Description copied from interface: DataSerializable
Writes the state of this object as primitive data to the given DataOutput.

Specified by:
toData in interface DataSerializable
Throws:
IOException - A problem occurs while writing to out

fromData

public void fromData(DataInput in)
              throws IOException,
                     ClassNotFoundException
Description copied from interface: DataSerializable
Reads the state of this object as primitive data from the given DataInput.

Specified by:
fromData in interface DataSerializable
Throws:
IOException - A problem occurs while reading from in
ClassNotFoundException - A class could not be loaded while reading from in

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

GemFire 5.5.1

Copyright © 2002-2008 GemStone Systems, Inc. All Rights Reserved.