org.softamis.net.exchange.jgroups
Class JGCommunicationProtocol<K extends java.io.Serializable,V extends java.io.Serializable>

java.lang.Object
  extended by org.softamis.net.exchange.support.AbstractCommunicationProtocol<org.jgroups.Message,K,V,java.lang.String>
      extended by org.softamis.net.exchange.jgroups.JGCommunicationProtocol<K,V>
Type Parameters:
K - type of keys used to identify registry items
V - type of values stored in the registry
All Implemented Interfaces:
CommunicationProtocol<org.jgroups.Message,K,V>

public class JGCommunicationProtocol<K extends java.io.Serializable,V extends java.io.Serializable>
extends AbstractCommunicationProtocol<org.jgroups.Message,K,V,java.lang.String>

Default implementation of CommunicationProtocol if JGroups reliable multicast is used as underlying network transport protocol.

Author:
Andrew Sazonov
See Also:
RegistryEventProcessor

Field Summary
static java.lang.String DEFAULT_DATAGRAM_SIGNATURE
          Default signature in sent message
protected static org.apache.commons.logging.Log fLog
           
 
Fields inherited from class org.softamis.net.exchange.support.AbstractCommunicationProtocol
DEFAULT_COMPRESSION_MODE, fDatagramSignature, fUseCompression, MSG_EXCEPTION_CLOSING_STREAM
 
Constructor Summary
JGCommunicationProtocol()
           
 
Method Summary
protected  MessageContent<K,V,java.lang.String> createMessageContent(byte aType, java.lang.String aTo, ItemEntry<K,V> aEntry)
          Creates MessageContent which will be converted into form used by underlying network communication based on provided parameters.
protected  org.jgroups.Message doCreateDataToSend(MessageContent<K,V,java.lang.String> aContent)
          Converts given MessageContent to form used by underlying network communication
protected  MessageContent<K,V,java.lang.String> getDatagramFromReceivedData(org.jgroups.Message aReceivedData)
          Constructs MessageContent from underlying network data.
protected  boolean isNotOwnDatagaram(MessageContent<K,V,java.lang.String> aDatagram)
          Determines whether notification was obtained from external source
 
Methods inherited from class org.softamis.net.exchange.support.AbstractCommunicationProtocol
closeStream, closeStream, createDataToSend, createMessageContentToRead, fillEntryByMessageContent, fillItemEntry, getDatagram, getDatagramSignature, getDataToSend, isUseCompression, setDatagramSignature, setUseCompression
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fLog

protected static final org.apache.commons.logging.Log fLog

DEFAULT_DATAGRAM_SIGNATURE

public static final java.lang.String DEFAULT_DATAGRAM_SIGNATURE
Default signature in sent message

See Also:
Constant Field Values
Constructor Detail

JGCommunicationProtocol

public JGCommunicationProtocol()
Method Detail

createMessageContent

protected MessageContent<K,V,java.lang.String> createMessageContent(byte aType,
                                                                    java.lang.String aTo,
                                                                    ItemEntry<K,V> aEntry)
Description copied from class: AbstractCommunicationProtocol
Creates MessageContent which will be converted into form used by underlying network communication based on provided parameters.

Specified by:
createMessageContent in class AbstractCommunicationProtocol<org.jgroups.Message,K extends java.io.Serializable,V extends java.io.Serializable,java.lang.String>
Parameters:
aType - type of notification
aTo - destination of notification
aEntry - Item data
Returns:
created message content

doCreateDataToSend

protected org.jgroups.Message doCreateDataToSend(MessageContent<K,V,java.lang.String> aContent)
Description copied from class: AbstractCommunicationProtocol
Converts given MessageContent to form used by underlying network communication

Specified by:
doCreateDataToSend in class AbstractCommunicationProtocol<org.jgroups.Message,K extends java.io.Serializable,V extends java.io.Serializable,java.lang.String>
Parameters:
aContent - given message content
Returns:
data in form ready to send via network by CommunicationHelper

isNotOwnDatagaram

protected boolean isNotOwnDatagaram(MessageContent<K,V,java.lang.String> aDatagram)
Description copied from class: AbstractCommunicationProtocol
Determines whether notification was obtained from external source

Specified by:
isNotOwnDatagaram in class AbstractCommunicationProtocol<org.jgroups.Message,K extends java.io.Serializable,V extends java.io.Serializable,java.lang.String>
Parameters:
aDatagram - data to receive
Returns:
true if data was obtained from external source

getDatagramFromReceivedData

protected MessageContent<K,V,java.lang.String> getDatagramFromReceivedData(org.jgroups.Message aReceivedData)
Description copied from class: AbstractCommunicationProtocol
Constructs MessageContent from underlying network data.

Specified by:
getDatagramFromReceivedData in class AbstractCommunicationProtocol<org.jgroups.Message,K extends java.io.Serializable,V extends java.io.Serializable,java.lang.String>
Parameters:
aReceivedData - raw data obtained in network notification
Returns:
constructed content