com.boylesoftware.cb2.bcmproviders.sockethub
Class SocketHubBCMProvider

java.lang.Object
  extended bycom.boylesoftware.cb2.bcmproviders.sockethub.SocketHubBCMProvider
All Implemented Interfaces:
BroadcastMessagingProvider

public class SocketHubBCMProvider
extends java.lang.Object
implements BroadcastMessagingProvider

Implementation of BCM provider, which uses a centralized hub to broadcast messages to all registered cluster members over TCP.

This provider implementation requires two application properties that point it to the location of the hub. The properties are:

Version:
$Id: SocketHubBCMProvider.java,v 1.6 2004/04/08 18:32:23 levahim Exp $
Author:
Lev Himmelfarb

Field Summary
 
Fields inherited from interface com.boylesoftware.cb2.BroadcastMessagingProvider
LOG_SUBSYS
 
Constructor Summary
SocketHubBCMProvider()
           
 
Method Summary
 void broadcastMessage(java.lang.String channelName, java.io.Serializable messageParam)
          Broadcast a message to all cluster members.
 void destroy()
          Destroy the provider instance and close the connection to the hub.
 void init(ApplicationContext appCtx)
          Initialize the provider.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocketHubBCMProvider

public SocketHubBCMProvider()
Method Detail

init

public void init(ApplicationContext appCtx)
          throws ApplicationException
Initialize the provider.

Specified by:
init in interface BroadcastMessagingProvider
Parameters:
appCtx - the application context.
Throws:
ApplicationException - if the provider cannot be intialized.

destroy

public void destroy()
Destroy the provider instance and close the connection to the hub.

Specified by:
destroy in interface BroadcastMessagingProvider

broadcastMessage

public void broadcastMessage(java.lang.String channelName,
                             java.io.Serializable messageParam)
Broadcast a message to all cluster members. This implementation actually sends the message to the hub and then the hub sends it to all connected clients including this one. The message is not sent immediately by this method, but placed into a queue so the method may return before the message is actually delivered (even to the local instance itself).

Specified by:
broadcastMessage in interface BroadcastMessagingProvider
Parameters:
channelName - target BCM channel name.
messageParam - optional message parameter, may be null.


Copyright © 2002,2003,2004 - Boyle Software, Inc.