## org.jgroups.blocks
Class MembershipListenerAdapter

    java.lang.Object
      org.jgroups.blocks.MembershipListenerAdapter

All Implemented Interfaces:
  MembershipListener

Direct Known Subclasses:
  PartitionedHashMap.ArrayBasedConsistentHashFunction, PartitionedHashMap.ConsistentHashFunction

    public class MembershipListenerAdapter

extends java.lang.Object
implements MembershipListener

This class provides multiplexing possibilities for `MembershipListener` instances. Usually, we have more than one instance willing to listen to membership messages. `PullPushAdapter` allows only one instance of `MembershipListener` to be registered for message notification. With help of this class you can overcome this limitation.

Author:
  Roman Rokytskyy (rrokytskyy@acm.org)

Field Summary
`protected java.util.HashSet` `membershipListeners`
`protected MembershipListener[]` `membershipListenersCache`

Constructor Summary
`MembershipListenerAdapter()`

Method Summary
`void` `addMembershipListener(MembershipListener listener)` Add membership listener to this adapter.
`void` `block()` Notify membership listeners to temporarily stop sending messages into a channel.
`void` `removeMembershipListener(MembershipListener listener)` Remove membership listener from this adapter.
`void` `suspect(Address suspected_mbr)` Notify membership listener that some node was suspected.
`void` `unblock()`
`void` `viewAccepted(View new_view)` Notify membership listener that new view was accepted.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### membershipListeners

    protected final java.util.HashSet membershipListeners

### membershipListenersCache

    protected MembershipListener[] membershipListenersCache

Constructor Detail

### MembershipListenerAdapter

    public MembershipListenerAdapter()

Method Detail

### block

    public void block()

  Notify membership listeners to temporarily stop sending messages into a channel. This method in turn calls same method of all registered membership listener.

  Specified by:
    `block` in interface `MembershipListener`

### unblock

    public void unblock()

### suspect

    public void suspect(Address suspected_mbr)

  Notify membership listener that some node was suspected. This method in turn passes suspected member address to all registered membership listeners.

  Specified by:
    `suspect` in interface `MembershipListener`

### viewAccepted

    public void viewAccepted(View new_view)

  Notify membership listener that new view was accepted. This method in turn passes new view to all registered membership listeners.

  Specified by:
    `viewAccepted` in interface `MembershipListener`

### addMembershipListener

    public void addMembershipListener(MembershipListener listener)

  Add membership listener to this adapter. This method registers `listener` to be notified when membership event is generated.

  Parameters:
    `listener` - instance of `MembershipListener` that should be added to this adapter.

### removeMembershipListener

    public void removeMembershipListener(MembershipListener listener)

  Remove membership listener from this adapter. This method deregisters `listener` from notification when membership event is generated.

  Parameters:
    `listener` - instance of `MembershipListener` that should be removed from this adapter.

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