|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.ow2.jonas.discovery.base.DiscHelper org.ow2.jonas.discovery.jgroups.utils.JGroupsDiscoveryUtils
public class JGroupsDiscoveryUtils
Field Summary | |
---|---|
static String |
DEF_GROUP_NAME
Default group name for discovery channel. |
static String |
DEFAULT_DOMAIN_NAME
The default domain name. |
static String |
DEFAULT_JONAS_NAME
The jonas name. |
static String |
DEFAULT_SERVER_ID
The default server Id. |
static String |
DEFAULT_STACK_FILENAME
Default file name for the stack. |
static String |
DISCOVERY_GREETING_IP
The default greeting Ip. |
static String |
DISCOVERY_GREETING_PORT_DEFAULT
The default greeting port name. |
static String |
DISCOVERY_GREETING_TIMEOUT_DEFAULT
The default JGroups discovery timeout. |
static String |
DISCOVERY_IS_CLUSTERD
The default key for discovery master started by clusterd. |
static String |
DISCOVERY_IS_MASTER
The default key for discovery master started by JOnAS server. |
static String |
DISCOVERY_IS_SLAVE
The default key for discovery slave started by JOnAS server. |
static String |
DISCOVERY_PROTOCOL_VERSION
The JGroups discovery version. |
static boolean |
duplicateExceptionName
Used by greeting receiver and communication manager. |
static String |
JGROUPS_CONFIG_PROPERTY
default Jgroups discovery configuration file property name. |
Method Summary | |
---|---|
static Object |
bytesToObject(Data data)
Convert network datas into a discovey communication object. |
static void |
closeChannel()
Close JGroups channel. |
static void |
connectChannel()
Connect the channel. |
static DiscGreeting |
createDiscGreeting(boolean startup)
Create a discovery greeting message. |
static DiscEvent |
createNotifMessage(String state)
Create a discovery event to notify about a state change of the event sender |
static DiscEvent |
createNotifMessageForClusterd(String state)
Create a discovery event to notify about a state change of the event sender |
static void |
disconnectChannel()
dDsconnect the channel. |
org.ow2.util.cluster.jgroups.IChannel |
getChannel()
Gets the channel |
static DiscoveryUtils |
getInstance()
Gets Discovery utils instance. |
static String |
getMulticastAddress()
Gets Multicast address. |
static String |
getMulticastPort()
Gets Multicast port. |
static void |
init(String srvName,
String domain,
String discoveryType,
String confFileName,
String discoveryGroup,
MBeanServer beanServer,
String[] connUrls,
long reconnectionTimeout)
Initializes properties of the discovery(groupname, stackfile, channel...). |
static Data |
objectToBytes(Serializable obj)
Construct a byte[] containing type info about a DiscMessage object to be sent, plus the content of this message. |
static void |
send(org.jgroups.Address dest,
Serializable msg)
Sends a given message to the given dest. |
void |
setChannel(org.ow2.util.cluster.jgroups.IChannel channel)
Sets the channel |
Methods inherited from class org.ow2.jonas.discovery.base.DiscHelper |
---|
bytesToObject, objectToBytes |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static boolean duplicateExceptionName
public static final String JGROUPS_CONFIG_PROPERTY
public static final String DEFAULT_STACK_FILENAME
public static final String DEFAULT_JONAS_NAME
public static final String DEFAULT_DOMAIN_NAME
public static final String DEFAULT_SERVER_ID
public static final String DISCOVERY_GREETING_PORT_DEFAULT
public static final String DISCOVERY_GREETING_IP
public static final String DISCOVERY_PROTOCOL_VERSION
public static final String DISCOVERY_GREETING_TIMEOUT_DEFAULT
public static final String DISCOVERY_IS_MASTER
public static final String DISCOVERY_IS_SLAVE
public static final String DISCOVERY_IS_CLUSTERD
public static final String DEF_GROUP_NAME
Method Detail |
---|
public org.ow2.util.cluster.jgroups.IChannel getChannel()
public void setChannel(org.ow2.util.cluster.jgroups.IChannel channel)
channel
- the channel to setpublic static void init(String srvName, String domain, String discoveryType, String confFileName, String discoveryGroup, MBeanServer beanServer, String[] connUrls, long reconnectionTimeout) throws Throwable
srvName
- The host name of discovery.domain
- The domain name of discovery's host.discoveryType
- The discovery type.confFileName
- The file name of JGroups stack.discoveryGroup
- The group of JGroups discovery (channel connection)beanServer
- The Mbean server of discovery's host.connUrls
- Connectors urls of discovery hosts.
Throwable
public static void connectChannel() throws org.jgroups.ChannelException
org.jgroups.ChannelException
public static void disconnectChannel() throws org.jgroups.ChannelException
org.jgroups.ChannelException
public static DiscGreeting createDiscGreeting(boolean startup) throws UnknownHostException
startup
- -
true: means that is a greeting message at the point of start
up of the discovery service. false: means this is a reply to
a previous greeting message.
UnknownHostException
- If host is unknownpublic static Object bytesToObject(Data data) throws IOException, ClassNotFoundException
data
-
DiscGreeting || DiscMessage || DiscEvent
IOException
ClassNotFoundException
public static Data objectToBytes(Serializable obj) throws IOException
obj
- Object to be send. Only supported DiscMessage objects.
IOException
- Could not create an ObjectOutputStream to write into the
underlying ByteArrayOutputStream.public static DiscEvent createNotifMessage(String state) throws Exception
state
- - RUNNING if the sender notifies that it gets running
- STOPPING if the sender notifies that it stops running
Exception
- is thrown if the jmx service is not reached.public static DiscEvent createNotifMessageForClusterd(String state) throws Exception
state
- - RUNNING if the sender notifies that it gets running
- STOPPING if the sender notifies that it stops running
Exception
- is thrown if the jmx service is not reached.public static void send(org.jgroups.Address dest, Serializable msg) throws Exception
dest
- The message destination.msg
- The message to send.
Exception
- Any.public static void closeChannel()
public static String getMulticastAddress() throws Exception
Exception
public static String getMulticastPort() throws Exception
Exception
public static DiscoveryUtils getInstance()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |