|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.softamis.net.exchange.support.AbstractCommunicationHelper<org.jgroups.Message,K,V> org.softamis.net.exchange.jgroups.JGCommunicationHelper<K,V>
K
- type of keys used to identify registry itemsV
- type of values stored in the registrypublic class JGCommunicationHelper<K extends java.io.Serializable,V extends java.io.Serializable>
Implementation of CommunicationHelper that uses JGroups reliable multicast as underlying trasport mechanizm of network communications. This implementation of communication helper listens messages from contained JGroups PullPushAdapter which could be specified outside during instance initialization (or created internally).
RegistryEventProcessor
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_GROUP_NAME
|
static java.lang.String |
DEFAULT_PROPERTIES
|
static java.lang.String |
DEFAULT_SIGNATURE
|
protected org.jgroups.blocks.PullPushAdapter |
fAdapter
Adapter used to perform communication |
protected org.jgroups.JChannel |
fDefaultChannel
JGroups channel that is created if adapter is not specified from outside |
protected java.lang.String |
fDefaultProperties
Properties that are used for creation of JGroups JChannel if adapter should be created |
protected static org.apache.commons.logging.Log |
fLog
|
protected boolean |
fOwnAdapter
Flag that indicates whether adapter was not set from outside and therefore was created |
protected java.io.Serializable |
fSignature
Signature used to select JGroups messages |
Fields inherited from class org.softamis.net.exchange.support.AbstractCommunicationHelper |
---|
fCommunicationProtocol, fDefaultGroupName, fDefaultMessageSignature, fOwnCommunicationProtocol, fRegistryEventsMulticaster |
Fields inherited from interface org.softamis.net.exchange.CommunicationHelper |
---|
COMMAND_ITEM_INVALID, COMMAND_ITEM_REGISTERED, COMMAND_ITEM_REQUEST, COMMAND_ITEM_UNREGISTERED |
Constructor Summary | |
---|---|
JGCommunicationHelper()
|
Method Summary | |
---|---|
void |
close()
Used to close helper after usage at the end of lifecycle. |
org.jgroups.blocks.PullPushAdapter |
getAdapter()
Returns adapter used to perform communication |
java.lang.String |
getDefaultProperties()
Returns properties that are used for creation of JGroups JChannel if adapter should be created |
java.io.Serializable |
getSignature()
Returns signature used to select JGroups messages |
byte[] |
getState()
|
void |
init()
Method used for initialization of communication helper. |
protected void |
initAdapter()
|
protected void |
insureCommunicationProtocolSet()
|
protected void |
processUnexpectedMessage(byte aMessageType,
ItemEntry<K,V> aEntry)
Method that is used to handle messages with unexpected type. |
void |
receive(org.jgroups.Message aMessage)
|
protected void |
sendData(org.jgroups.Message aDataToSend)
Sends newtorking notification with provided data |
void |
setAdapter(org.jgroups.blocks.PullPushAdapter aAdapter)
Sets adapter used to perform communication |
void |
setDefaultProperties(java.lang.String aDefaultProperties)
Sets properties that are used for creation of JGroups JChannel if adapter should be created |
void |
setSignature(java.io.Serializable aSignature)
Sets signature used to select JGroups messages |
void |
setState(byte[] aState)
|
protected java.lang.String |
stripWhiteSpaces(java.lang.String aOriginalString)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final org.apache.commons.logging.Log fLog
protected org.jgroups.blocks.PullPushAdapter fAdapter
protected boolean fOwnAdapter
protected java.lang.String fDefaultProperties
protected org.jgroups.JChannel fDefaultChannel
public static final java.lang.String DEFAULT_GROUP_NAME
protected java.io.Serializable fSignature
public static final java.lang.String DEFAULT_SIGNATURE
public static final java.lang.String DEFAULT_PROPERTIES
Constructor Detail |
---|
public JGCommunicationHelper()
Method Detail |
---|
protected void insureCommunicationProtocolSet()
protected void processUnexpectedMessage(byte aMessageType, ItemEntry<K,V> aEntry)
AbstractCommunicationHelper
processUnexpectedMessage
in class AbstractCommunicationHelper<org.jgroups.Message,K extends java.io.Serializable,V extends java.io.Serializable>
aMessageType
- type of messageaEntry
- entry obtained with messagepublic void receive(org.jgroups.Message aMessage)
receive
in interface org.jgroups.MessageListener
public byte[] getState()
getState
in interface org.jgroups.MessageListener
public void setState(byte[] aState)
setState
in interface org.jgroups.MessageListener
protected void sendData(org.jgroups.Message aDataToSend)
AbstractCommunicationHelper
sendData
in class AbstractCommunicationHelper<org.jgroups.Message,K extends java.io.Serializable,V extends java.io.Serializable>
aDataToSend
- data which should be sentpublic void init() throws java.io.IOException
CommunicationHelper
init
in interface CommunicationHelper<K extends java.io.Serializable,V extends java.io.Serializable>
java.io.IOException
protected void initAdapter()
public void close()
CommunicationHelper
close
in interface CommunicationHelper<K extends java.io.Serializable,V extends java.io.Serializable>
public java.io.Serializable getSignature()
public void setSignature(java.io.Serializable aSignature)
aSignature
- signature used to select JGroups messagespublic org.jgroups.blocks.PullPushAdapter getAdapter()
public void setAdapter(org.jgroups.blocks.PullPushAdapter aAdapter)
aAdapter
- adapter used to perform communicationpublic java.lang.String getDefaultProperties()
public void setDefaultProperties(java.lang.String aDefaultProperties)
aDefaultProperties
- properties stringprotected java.lang.String stripWhiteSpaces(java.lang.String aOriginalString)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |