Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jgroups
Class View

    java.lang.Object
      org.jgroups.View

All Implemented Interfaces:
  java.io.Externalizable, java.io.Serializable, java.lang.Cloneable, Streamable

Direct Known Subclasses:
  MergeView

    public class View

extends java.lang.Object
implements java.io.Externalizable, java.lang.Cloneable, Streamable

A view is a local representation of the current membership of a group. Only one view is installed in a channel at a time. Views contain the address of its creator, an ID and a list of member addresses. These addresses are ordered, and the first address is always the coordinator of the view. This way, each member of the group knows who the new coordinator will be if the current one crashes or leaves the group. The views are sent between members using the VIEW_CHANGE event

Author:
  Bela Ban
See Also:
  Serialized Form

Field Summary
`protected java.util.Vector<Address>` | `members` A list containing all the members of the view This list is always ordered, with the coordinator being the first member.
`protected java.util.Map<java.lang.String,java.lang.Object>` | `payload` Deprecated.
`protected ViewId` | `vid`

Constructor Summary
`View()` creates an empty view, should not be used
`View(Address creator, long id, java.util.Collection<Address> members)` Creates a new view
`View(ViewId vid, java.util.Collection<Address> members)`
`View(ViewId vid, java.util.Vector<Address> members)` Creates a new view

Method Summary
`void` | `addPayload(java.lang.String key, java.lang.Object value)` Deprecated. Will be removed in 3.0
`java.lang.Object` | `clone()` creates a copy of this view
`boolean` | `containsMember(Address mbr)` returns true, if this view contains a certain member
`View` | `copy()`
`boolean` | `equals(java.lang.Object obj)`
`Address` | `getCreator()` returns the creator of this view if this view was created with the empty constructur, null will be returned
`java.util.Vector<Address>` | `getMembers()` Returns a reference to the List of members (ordered) Do NOT change this list, hence your will invalidate the view Make a copy if you have to modify it.
`java.lang.Object` | `getPayload(java.lang.String key)` Deprecated. Will be removed in 3.0
`ViewId` | `getVid()` returns the view ID of this view if this view was created with the empty constructur, null will be returned
`ViewId` | `getViewId()`
`int` | `hashCode()`
`java.lang.String` | `printDetails()` debug only
`void` | `readExternal(java.io.ObjectInput in)`
`void` | `readFrom(java.io.DataInputStream in)` Read the state of the current object (including superclasses) from instream Note that the input stream must not be closed
`java.lang.Object` | `removePayload(java.lang.String key)` Deprecated. Will be removed in 3.0
`int` | `serializedSize()`
`int` | `size()` returns the number of members in this view
`java.lang.String` | `toString()`
`void` | `writeExternal(java.io.ObjectOutput out)`
`void` | `writeTo(java.io.DataOutputStream out)` Write the entire state of the current object (including superclasses) to outstream.

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### vid

    protected ViewId vid

### members

    protected java.util.Vector<Address> members

  A list containing all the members of the view This list is always ordered, with the coordinator being the first member. the second member will be the new coordinator if the current one disappears or leaves the group.

### payload

    @Deprecated
    protected java.util.Map<java.lang.String,java.lang.Object> payload

  Deprecated.

Constructor Detail

### View

    public View()

  creates an empty view, should not be used

### View

    public View(ViewId vid,
                java.util.Vector<Address> members)

  Creates a new view

  Parameters:
    `vid` - The view id of this view (can not be null)
    `members` - Contains a list of all the members in the view, can be empty but not null.

### View

    public View(ViewId vid,
                java.util.Collection<Address> members)

### View

    public View(Address creator,
                long id,
                java.util.Collection<Address> members)

  Creates a new view

  Parameters:
    `creator` - The creator of this view (can not be null)
    `id` - The lamport timestamp of this view
    `members` - Contains a list of all the members in the view, can be empty but not null.

Method Detail

### getVid

    public ViewId getVid()

  returns the view ID of this view if this view was created with the empty constructur, null will be returned

  Returns:
    the view ID of this view

### getViewId

    public ViewId getViewId()

### getCreator

    public Address getCreator()

  returns the creator of this view if this view was created with the empty constructur, null will be returned

  Returns:
    the creator of this view in form of an Address object

### getMembers

    public java.util.Vector<Address> getMembers()

  Returns a reference to the List of members (ordered) Do NOT change this list, hence your will invalidate the view Make a copy if you have to modify it.

  Returns:
    a reference to the ordered list of members in this view

### containsMember

    public boolean containsMember(Address mbr)

  returns true, if this view contains a certain member

  Parameters:
    `mbr` - - the address of the member,
  Returns:
    true if this view contains the member, false if it doesn't if the argument mbr is null, this operation returns false

### equals

    public boolean equals(java.lang.Object obj)

  Overrides:
    `equals` in class `java.lang.Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`

### size

    public int size()

  returns the number of members in this view

  Returns:
    the number of members in this view 0..n

### copy

    public View copy()

### clone

    public java.lang.Object clone()

  creates a copy of this view

  Overrides:
    `clone` in class `java.lang.Object`
  Returns:
    a copy of this view

### printDetails

    public java.lang.String printDetails()

  debug only

### addPayload

    public void addPayload(java.lang.String key,
                           java.lang.Object value)

  Deprecated. Will be removed in 3.0

  Adds a key and value to the view. Since the payloads will be shipped around *with* the view, so the keys and values need to be serializable. Note that the total serialized size of all keys and values cannot exceed 65000 bytes !

  Parameters:
    `key` -
    `value` -

### removePayload

    public java.lang.Object removePayload(java.lang.String key)

  Deprecated. Will be removed in 3.0

  Parameters:
    `key` -
  Returns:

### getPayload

    public java.lang.Object getPayload(java.lang.String key)

  Deprecated. Will be removed in 3.0

  Parameters:
    `key` -
  Returns:

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### writeExternal

    public void writeExternal(java.io.ObjectOutput out)
                       throws java.io.IOException

  Specified by:
    `writeExternal` in interface `java.io.Externalizable`
  Throws:
    `java.io.IOException`

### readExternal

    public void readExternal(java.io.ObjectInput in)
                      throws java.io.IOException,
                             java.lang.ClassNotFoundException

  Specified by:
    `readExternal` in interface `java.io.Externalizable`
  Throws:
    `java.io.IOException`
    `java.lang.ClassNotFoundException`

### writeTo

    public void writeTo(java.io.DataOutputStream out)
                 throws java.io.IOException

  Description copied from interface: `Streamable`
  Write the entire state of the current object (including superclasses) to outstream. Note that the output stream must not be closed

  Specified by:
    `writeTo` in interface `Streamable`
  Throws:
    `java.io.IOException`

### readFrom

    public void readFrom(java.io.DataInputStream in)
                  throws java.io.IOException,
                         java.lang.IllegalAccessException,
                         java.lang.InstantiationException

  Description copied from interface: `Streamable`
  Read the state of the current object (including superclasses) from instream Note that the input stream must not be closed

  Specified by:
    `readFrom` in interface `Streamable`
  Throws:
    `java.io.IOException`
    `java.lang.IllegalAccessException`
    `java.lang.InstantiationException`

### serializedSize

    public int serializedSize()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1998-2009 Bela Ban / Red Hat. All Rights Reserved.