com.continuent.tungsten.common.patterns.notification.adaptor
Class MonitorNotifierGroupCommAdaptor

java.lang.Object
  extended by com.continuent.tungsten.common.patterns.notification.adaptor.MonitorNotifierGroupCommAdaptor
All Implemented Interfaces:
ResourceNotifier, java.lang.Runnable, org.continuent.hedera.adapters.MessageListener

public class MonitorNotifierGroupCommAdaptor
extends java.lang.Object
implements org.continuent.hedera.adapters.MessageListener, ResourceNotifier

This class represents a means to receive monitoring information about datasources from group communications. This works with a variety of GC implementations thanks to using Hedera wrappers.

Version:
1.0
Author:
Ed Archibald

Constructor Summary
MonitorNotifierGroupCommAdaptor()
          Create a new adapter.
 
Method Summary
 void addListener(ResourceNotificationListener listener)
          Add a listener that will be informed in the event of a resource notification.
 void configureGroupCommunications()
           
 java.util.Map<java.lang.String,NotificationGroupMember> getNotificationGroupMembers()
           
 void notifyListeners(ClusterResourceNotification notification)
          Deliver notification to listeners.
 void prepare()
           
 void receive(java.io.Serializable object)
          Receive a resource notification.
 void run()
          Run start the listener thread.
 void shutdown()
          Shut down by logging out of the channel.
 void startGroupCommunications()
          Start group communications by launching the message adapter thread.
protected  void stopGroupCommunications()
          Shut down group communications.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MonitorNotifierGroupCommAdaptor

public MonitorNotifierGroupCommAdaptor()
                                throws ResourceNotificationException
Create a new adapter.

Throws:
ResourceNotificationException
Method Detail

addListener

public void addListener(ResourceNotificationListener listener)
Add a listener that will be informed in the event of a resource notification.

Specified by:
addListener in interface ResourceNotifier
Parameters:
listener -

notifyListeners

public void notifyListeners(ClusterResourceNotification notification)
                     throws ResourceNotificationException
Deliver notification to listeners.

Specified by:
notifyListeners in interface ResourceNotifier
Parameters:
notification -
Throws:
ResourceNotificationException

run

public void run()
Run start the listener thread. It turns out that Group communications don't really need a separate thread since the group comm adapters have their own threads. So we start group comm instead.

Specified by:
run in interface java.lang.Runnable

configureGroupCommunications

public void configureGroupCommunications()
                                  throws ResourceNotificationException
Throws:
ResourceNotificationException

startGroupCommunications

public void startGroupCommunications()
Start group communications by launching the message adapter thread.


stopGroupCommunications

protected void stopGroupCommunications()
Shut down group communications.


shutdown

public void shutdown()
Shut down by logging out of the channel.


receive

public void receive(java.io.Serializable object)
Receive a resource notification. This should be a HashMap.

Specified by:
receive in interface org.continuent.hedera.adapters.MessageListener

getNotificationGroupMembers

public java.util.Map<java.lang.String,NotificationGroupMember> getNotificationGroupMembers()
Specified by:
getNotificationGroupMembers in interface ResourceNotifier

prepare

public void prepare()
             throws java.lang.Exception
Specified by:
prepare in interface ResourceNotifier
Throws:
java.lang.Exception