com.sun.enterprise.mgmt.transport.grizzly
Class GrizzlyNetworkManager

java.lang.Object
  extended by com.sun.enterprise.mgmt.transport.AbstractNetworkManager
      extended by com.sun.enterprise.mgmt.transport.grizzly.GrizzlyNetworkManager
All Implemented Interfaces:
MessageSender, MulticastMessageSender, NetworkManager, ShoalMessageSender
Direct Known Subclasses:
GrizzlyNetworkManager1_9, GrizzlyNetworkManager2

public abstract class GrizzlyNetworkManager
extends AbstractNetworkManager

Author:
Bongjae Chang

Field Summary
 String DEFAULT_IPv4_MULTICAST_ADDRESS
           
 String DEFAULT_IPv6_MULTICAST_ADDRESS
           
protected  boolean disableMulticast
           
 long failTcpTimeout
           
 String groupName
           
protected  int highWaterMark
           
 String host
           
 String instanceName
           
 Logger LOG
           
protected  int maxParallelSendConnections
           
 String multicastAddress
           
 int multicastPacketSize
           
 int multicastPort
           
 MulticastMessageSender multicastSender
           
 int multicastTimeToLive
           
 String networkInterfaceName
           
 Logger nomcastLogger
           
protected  int numberToReclaim
           
 ConcurrentHashMap<String,PeerID<GrizzlyPeerID>> peerIDMap
           
 ConcurrentHashMap<PeerID,CountDownLatch> pingMessageLockMap
           
 boolean running
           
 long sendWriteTimeoutMillis
           
 long startTimeoutMillis
           
 int tcpEndPort
           
 int tcpPort
           
 MessageSender tcpSender
           
 int tcpStartPort
           
 MessageSender udpSender
           
 String UNKNOWN
           
protected  String virtualUriList
           
protected  VirtualMulticastSender vms
           
 int writeSelectorPoolSize
           
 
Fields inherited from class com.sun.enterprise.mgmt.transport.AbstractNetworkManager
localPeerID
 
Fields inherited from interface com.sun.enterprise.mgmt.transport.ShoalMessageSender
TCP_TRANSPORT, UDP_TRANSPORT
 
Constructor Summary
GrizzlyNetworkManager()
           
 
Method Summary
 void addRemotePeer(PeerID peerID)
          Add the peerID to this network manager
protected  void addToVMS(PeerID peerID)
           
 void afterDispatchingMessage(MessageEvent messageEvent, Map piggyback)
          After executing MessageListener.receiveMessageEvent(MessageEvent)} callback, this method will be called
 void beforeDispatchingMessage(MessageEvent messageEvent, Map piggyback)
          Before executing MessageListener.receiveMessageEvent(MessageEvent)} callback, this method will be called
 boolean broadcast(Message message)
          Broadcasts or Multicasts the given Message to all members
 void configure(Map properties)
           
protected abstract  Logger getGrizzlyLogger()
           
 MessageSender getMessageSender(int transport)
          Returns a MessageSender corresponding with transport type
 MulticastMessageSender getMulticastMessageSender()
          Returns a MulticastMessageSender
 PeerID getPeerID(String instanceName)
          Returns the proper PeerID corresponding with a given instance name
protected  PeerID<GrizzlyPeerID> getPeerIDFromURI(String uri)
           
 CountDownLatch getPingMessageLock(PeerID peerID)
           
protected  List<PeerID> getVirtualPeerIDList(String groupDiscoveryUriList)
           
 void initialize(String groupName, String instanceName, Map properties)
          Initializes this network manager with given params and properties
 boolean isConnected(PeerID peerID)
          Check whether the suspicious peer is alive or not This API is mainly used in HealthMonitor in order to determine the failure member
protected  boolean isLeavingMessage(MessageEvent msgEvent)
           
protected  void removeFromVMS(PeerID peerID)
           
 void removePeerID(PeerID peerID)
          Removes the peerID from this network manager
 void removeRemotePeer(String instanceName)
           
 boolean send(PeerID peerID, Message message)
          Sends the given Message to the destination
 void start()
          Starts this network manager This method will be called after NetworkManager.initialize(String, String, java.util.Map) internally
 void stop()
          Stops this network manager For cleaning up remaining values and finishing I/O operation, this method could be used
 
Methods inherited from class com.sun.enterprise.mgmt.transport.AbstractNetworkManager
addMessageListener, getInstance, getLocalPeerID, getLogger, receiveMessage, removeMessageListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public final Logger LOG

nomcastLogger

public final Logger nomcastLogger

peerIDMap

public final ConcurrentHashMap<String,PeerID<GrizzlyPeerID>> peerIDMap

running

public volatile boolean running

tcpSender

public MessageSender tcpSender

udpSender

public MessageSender udpSender

multicastSender

public MulticastMessageSender multicastSender

multicastTimeToLive

public int multicastTimeToLive

instanceName

public String instanceName

groupName

public String groupName

host

public String host

tcpPort

public int tcpPort

tcpStartPort

public int tcpStartPort

tcpEndPort

public int tcpEndPort

multicastPort

public int multicastPort

multicastAddress

public String multicastAddress

networkInterfaceName

public String networkInterfaceName

failTcpTimeout

public long failTcpTimeout

highWaterMark

protected int highWaterMark

numberToReclaim

protected int numberToReclaim

maxParallelSendConnections

protected int maxParallelSendConnections

startTimeoutMillis

public long startTimeoutMillis

sendWriteTimeoutMillis

public long sendWriteTimeoutMillis

multicastPacketSize

public int multicastPacketSize

writeSelectorPoolSize

public int writeSelectorPoolSize

UNKNOWN

public final String UNKNOWN
See Also:
Constant Field Values

DEFAULT_IPv4_MULTICAST_ADDRESS

public final String DEFAULT_IPv4_MULTICAST_ADDRESS
See Also:
Constant Field Values

DEFAULT_IPv6_MULTICAST_ADDRESS

public final String DEFAULT_IPv6_MULTICAST_ADDRESS
See Also:
Constant Field Values

pingMessageLockMap

public final ConcurrentHashMap<PeerID,CountDownLatch> pingMessageLockMap

vms

protected VirtualMulticastSender vms

disableMulticast

protected boolean disableMulticast

virtualUriList

protected String virtualUriList
Constructor Detail

GrizzlyNetworkManager

public GrizzlyNetworkManager()
Method Detail

configure

public void configure(Map properties)

initialize

public void initialize(String groupName,
                       String instanceName,
                       Map properties)
                throws IOException
Description copied from interface: NetworkManager
Initializes this network manager with given params and properties

Specified by:
initialize in interface NetworkManager
Overrides:
initialize in class AbstractNetworkManager
Parameters:
groupName - group name
instanceName - instance name
properties - specific properties
Throws:
IOException - if an unexpected error occurs

start

public void start()
           throws IOException
Description copied from class: AbstractNetworkManager
Starts this network manager This method will be called after NetworkManager.initialize(String, String, java.util.Map) internally

Specified by:
start in interface NetworkManager
Specified by:
start in interface ShoalMessageSender
Overrides:
start in class AbstractNetworkManager
Throws:
IOException - if an I/O error occurs

stop

public void stop()
          throws IOException
Description copied from class: AbstractNetworkManager
Stops this network manager For cleaning up remaining values and finishing I/O operation, this method could be used

Specified by:
stop in interface NetworkManager
Specified by:
stop in interface ShoalMessageSender
Overrides:
stop in class AbstractNetworkManager
Throws:
IOException - if an I/O error occurs

beforeDispatchingMessage

public void beforeDispatchingMessage(MessageEvent messageEvent,
                                     Map piggyback)
Description copied from class: AbstractNetworkManager
Before executing MessageListener.receiveMessageEvent(MessageEvent)} callback, this method will be called

Specified by:
beforeDispatchingMessage in class AbstractNetworkManager
Parameters:
messageEvent - a received MessageEvent
piggyback - piggyback

afterDispatchingMessage

public void afterDispatchingMessage(MessageEvent messageEvent,
                                    Map piggyback)
Description copied from class: AbstractNetworkManager
After executing MessageListener.receiveMessageEvent(MessageEvent)} callback, this method will be called

Specified by:
afterDispatchingMessage in class AbstractNetworkManager
Parameters:
messageEvent - a received MessageEvent
piggyback - piggyback

addRemotePeer

public void addRemotePeer(PeerID peerID)
Description copied from interface: NetworkManager
Add the peerID to this network manager


removeRemotePeer

public void removeRemotePeer(String instanceName)

send

public boolean send(PeerID peerID,
                    Message message)
             throws IOException
Description copied from interface: MessageSender
Sends the given Message to the destination

Parameters:
peerID - the destination PeerID. null is not allowed
message - a message which is sent to the peer
Returns:
true if the message is sent to the destination successfully, otherwise false
Throws:
IOException - if I/O error occurs or given parameters are not valid

broadcast

public boolean broadcast(Message message)
                  throws IOException
Description copied from interface: MulticastMessageSender
Broadcasts or Multicasts the given Message to all members

Parameters:
message - a message which is sent to all members
Returns:
true if the message is sent to all members successfully, otherwise false
Throws:
IOException - if I/O error occurs or given parameters are not valid

getPeerID

public PeerID getPeerID(String instanceName)
Description copied from interface: NetworkManager
Returns the proper PeerID corresponding with a given instance name

Parameters:
instanceName - instance name
Returns:
peer id

removePeerID

public void removePeerID(PeerID peerID)
Description copied from interface: NetworkManager
Removes the peerID from this network manager


isConnected

public boolean isConnected(PeerID peerID)
Description copied from interface: NetworkManager
Check whether the suspicious peer is alive or not This API is mainly used in HealthMonitor in order to determine the failure member

Parameters:
peerID - peer id
Returns:
true if the peer is still alive, otherwise false

getPingMessageLock

public CountDownLatch getPingMessageLock(PeerID peerID)

getMessageSender

public MessageSender getMessageSender(int transport)
Description copied from interface: NetworkManager
Returns a MessageSender corresponding with transport type

Parameters:
transport - transport type. ShoalMessageSender.TCP_TRANSPORT or ShoalMessageSender.UDP_TRANSPORT's integer value
Returns:
a MessageSender's instance which this network manager contains

getMulticastMessageSender

public MulticastMessageSender getMulticastMessageSender()
Description copied from interface: NetworkManager
Returns a MulticastMessageSender

Returns:
a MulticastMessageSender's instance which this network manager contains

getGrizzlyLogger

protected abstract Logger getGrizzlyLogger()

getVirtualPeerIDList

protected List<PeerID> getVirtualPeerIDList(String groupDiscoveryUriList)

getPeerIDFromURI

protected PeerID<GrizzlyPeerID> getPeerIDFromURI(String uri)
                                          throws URISyntaxException
Throws:
URISyntaxException

isLeavingMessage

protected boolean isLeavingMessage(MessageEvent msgEvent)

addToVMS

protected void addToVMS(PeerID peerID)

removeFromVMS

protected void removeFromVMS(PeerID peerID)


Copyright © 2012. All Rights Reserved.