Class GrizzlyNetworkManager
- java.lang.Object
-
- com.sun.enterprise.mgmt.transport.AbstractNetworkManager
-
- com.sun.enterprise.mgmt.transport.grizzly.GrizzlyNetworkManager
-
- All Implemented Interfaces:
MessageSender,MulticastMessageSender,NetworkManager,ShoalMessageSender
- Direct Known Subclasses:
GrizzlyNetworkManager2
public abstract class GrizzlyNetworkManager extends AbstractNetworkManager
- Author:
- Bongjae Chang
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_IPv4_MULTICAST_ADDRESSstatic java.lang.StringDEFAULT_IPv6_MULTICAST_ADDRESSprotected booleandisableMulticastlongfailTcpTimeoutjava.lang.StringgroupNameprotected inthighWaterMarkjava.lang.Stringhostjava.lang.StringinstanceNamejava.util.logging.LoggerLOGprotected intmaxParallelSendConnectionsjava.lang.StringmulticastAddressintmulticastPacketSizeintmulticastPortMulticastMessageSendermulticastSenderintmulticastTimeToLivejava.lang.StringnetworkInterfaceNamejava.util.logging.LoggernomcastLoggerprotected intnumberToReclaimjava.util.concurrent.ConcurrentHashMap<java.lang.String,PeerID<GrizzlyPeerID>>peerIDMapjava.util.concurrent.ConcurrentHashMap<PeerID,java.util.concurrent.CountDownLatch>pingMessageLockMapbooleanrunninglongsendWriteTimeoutMillislongstartTimeoutMillisinttcpEndPortinttcpPortMessageSendertcpSenderinttcpStartPortMessageSenderudpSenderstatic java.lang.StringUNKNOWNprotected java.lang.StringvirtualUriListprotected VirtualMulticastSendervmsintwriteSelectorPoolSize-
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
Constructors Constructor Description GrizzlyNetworkManager()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddRemotePeer(PeerID peerID)Add thepeerIDto this network managerprotected voidaddToVMS(PeerID peerID)voidafterDispatchingMessage(MessageEvent messageEvent, java.util.Map piggyback)After executingMessageListener.receiveMessageEvent(MessageEvent)} callback, this method will be calledvoidbeforeDispatchingMessage(MessageEvent messageEvent, java.util.Map piggyback)Before executingMessageListener.receiveMessageEvent(MessageEvent)} callback, this method will be calledbooleanbroadcast(Message message)Broadcasts or Multicasts the givenMessageto all membersvoidconfigure(java.util.Map properties)protected abstract java.util.logging.LoggergetGrizzlyLogger()MessageSendergetMessageSender(int transport)Returns aMessageSendercorresponding with transport typeMulticastMessageSendergetMulticastMessageSender()Returns aMulticastMessageSenderPeerIDgetPeerID(java.lang.String instanceName)Returns the properPeerIDcorresponding with a given instance nameprotected PeerID<GrizzlyPeerID>getPeerIDFromURI(java.lang.String uri)java.util.concurrent.CountDownLatchgetPingMessageLock(PeerID peerID)protected java.util.List<PeerID>getVirtualPeerIDList(java.lang.String groupDiscoveryUriList)voidinitialize(java.lang.String groupName, java.lang.String instanceName, java.util.Map properties)Initializes this network manager with given params and propertiesbooleanisConnected(PeerID peerID)Check whether the suspicious peer is alive or not This API is mainly used inHealthMonitorin order to determine the failure memberprotected booleanisLeavingMessage(MessageEvent msgEvent)protected voidremoveFromVMS(PeerID peerID)voidremovePeerID(PeerID peerID)Removes thepeerIDfrom this network managervoidremoveRemotePeer(java.lang.String instanceName)booleansend(PeerID peerID, Message message)Sends the givenMessageto the destinationvoidstart()Starts this network manager This method will be called afterNetworkManager.initialize(String, String, java.util.Map)internallyvoidstop()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
-
-
-
-
Field Detail
-
LOG
public final java.util.logging.Logger LOG
-
nomcastLogger
public final java.util.logging.Logger nomcastLogger
-
peerIDMap
public final java.util.concurrent.ConcurrentHashMap<java.lang.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 java.lang.String instanceName
-
groupName
public java.lang.String groupName
-
host
public java.lang.String host
-
tcpPort
public int tcpPort
-
tcpStartPort
public int tcpStartPort
-
tcpEndPort
public int tcpEndPort
-
multicastPort
public int multicastPort
-
multicastAddress
public java.lang.String multicastAddress
-
networkInterfaceName
public java.lang.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 static final java.lang.String UNKNOWN
- See Also:
- Constant Field Values
-
DEFAULT_IPv4_MULTICAST_ADDRESS
public static final java.lang.String DEFAULT_IPv4_MULTICAST_ADDRESS
- See Also:
- Constant Field Values
-
DEFAULT_IPv6_MULTICAST_ADDRESS
public static final java.lang.String DEFAULT_IPv6_MULTICAST_ADDRESS
- See Also:
- Constant Field Values
-
pingMessageLockMap
public final java.util.concurrent.ConcurrentHashMap<PeerID,java.util.concurrent.CountDownLatch> pingMessageLockMap
-
vms
protected VirtualMulticastSender vms
-
disableMulticast
protected boolean disableMulticast
-
virtualUriList
protected java.lang.String virtualUriList
-
-
Method Detail
-
configure
public void configure(java.util.Map properties)
-
initialize
public void initialize(java.lang.String groupName, java.lang.String instanceName, java.util.Map properties) throws java.io.IOExceptionDescription copied from interface:NetworkManagerInitializes this network manager with given params and properties- Specified by:
initializein interfaceNetworkManager- Overrides:
initializein classAbstractNetworkManager- Parameters:
groupName- group nameinstanceName- instance nameproperties- specific properties- Throws:
java.io.IOException- if an unexpected error occurs
-
start
public void start() throws java.io.IOExceptionDescription copied from class:AbstractNetworkManagerStarts this network manager This method will be called afterNetworkManager.initialize(String, String, java.util.Map)internally- Specified by:
startin interfaceNetworkManager- Specified by:
startin interfaceShoalMessageSender- Overrides:
startin classAbstractNetworkManager- Throws:
java.io.IOException- if an I/O error occurs
-
stop
public void stop() throws java.io.IOExceptionDescription copied from class:AbstractNetworkManagerStops this network manager For cleaning up remaining values and finishing I/O operation, this method could be used- Specified by:
stopin interfaceNetworkManager- Specified by:
stopin interfaceShoalMessageSender- Overrides:
stopin classAbstractNetworkManager- Throws:
java.io.IOException- if an I/O error occurs
-
beforeDispatchingMessage
public void beforeDispatchingMessage(MessageEvent messageEvent, java.util.Map piggyback)
Description copied from class:AbstractNetworkManagerBefore executingMessageListener.receiveMessageEvent(MessageEvent)} callback, this method will be called- Specified by:
beforeDispatchingMessagein classAbstractNetworkManager- Parameters:
messageEvent- a receivedMessageEventpiggyback- piggyback
-
afterDispatchingMessage
public void afterDispatchingMessage(MessageEvent messageEvent, java.util.Map piggyback)
Description copied from class:AbstractNetworkManagerAfter executingMessageListener.receiveMessageEvent(MessageEvent)} callback, this method will be called- Specified by:
afterDispatchingMessagein classAbstractNetworkManager- Parameters:
messageEvent- a receivedMessageEventpiggyback- piggyback
-
addRemotePeer
public void addRemotePeer(PeerID peerID)
Description copied from interface:NetworkManagerAdd thepeerIDto this network manager- Parameters:
peerID- the peer Id
-
removeRemotePeer
public void removeRemotePeer(java.lang.String instanceName)
-
send
public boolean send(PeerID peerID, Message message) throws java.io.IOException
Description copied from interface:MessageSenderSends the givenMessageto the destination- Parameters:
peerID- the destinationPeerID.nullis not allowedmessage- a message which is sent to the peer- Returns:
- true if the message is sent to the destination successfully, otherwise false
- Throws:
java.io.IOException- if I/O error occurs or given parameters are not valid
-
broadcast
public boolean broadcast(Message message) throws java.io.IOException
Description copied from interface:MulticastMessageSenderBroadcasts or Multicasts the givenMessageto 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:
java.io.IOException- if I/O error occurs or given parameters are not valid
-
getPeerID
public PeerID getPeerID(java.lang.String instanceName)
Description copied from interface:NetworkManagerReturns the properPeerIDcorresponding with a given instance name- Parameters:
instanceName- instance name- Returns:
- peer id
-
removePeerID
public void removePeerID(PeerID peerID)
Description copied from interface:NetworkManagerRemoves thepeerIDfrom this network manager- Parameters:
peerID- the peer Id
-
isConnected
public boolean isConnected(PeerID peerID)
Description copied from interface:NetworkManagerCheck whether the suspicious peer is alive or not This API is mainly used inHealthMonitorin order to determine the failure member- Parameters:
peerID- peer id- Returns:
- true if the peer is still alive, otherwise false
-
getPingMessageLock
public java.util.concurrent.CountDownLatch getPingMessageLock(PeerID peerID)
-
getMessageSender
public MessageSender getMessageSender(int transport)
Description copied from interface:NetworkManagerReturns aMessageSendercorresponding with transport type- Parameters:
transport- transport type.ShoalMessageSender.TCP_TRANSPORTorShoalMessageSender.UDP_TRANSPORT's integer value- Returns:
- a
MessageSender's instance which this network manager contains
-
getMulticastMessageSender
public MulticastMessageSender getMulticastMessageSender()
Description copied from interface:NetworkManagerReturns aMulticastMessageSender- Returns:
- a
MulticastMessageSender's instance which this network manager contains
-
getGrizzlyLogger
protected abstract java.util.logging.Logger getGrizzlyLogger()
-
getVirtualPeerIDList
protected java.util.List<PeerID> getVirtualPeerIDList(java.lang.String groupDiscoveryUriList)
-
getPeerIDFromURI
protected PeerID<GrizzlyPeerID> getPeerIDFromURI(java.lang.String uri) throws java.net.URISyntaxException
- Throws:
java.net.URISyntaxException
-
isLeavingMessage
protected boolean isLeavingMessage(MessageEvent msgEvent)
-
addToVMS
protected void addToVMS(PeerID peerID)
-
removeFromVMS
protected void removeFromVMS(PeerID peerID)
-
-