Package org.jgroups.tests
Class MessageDispatcherSpeedTest
- java.lang.Object
-
- org.jgroups.tests.MessageDispatcherSpeedTest
-
- All Implemented Interfaces:
RequestHandler,Receiver
public class MessageDispatcherSpeedTest extends java.lang.Object implements Receiver, RequestHandler
-
-
Field Summary
Fields Modifier and Type Field Description (package private) JChannelchannel(package private) MessageDispatcherdisp(package private) intnum(package private) java.lang.Stringprops(package private) intreceived(package private) booleanserver(package private) static longTIMEOUT
-
Constructor Summary
Constructors Constructor Description MessageDispatcherSpeedTest(java.lang.String props, boolean server, int num)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objecthandle(Message msg)Processes a request synchronously, ie.(package private) static voidhelp()static voidmain(java.lang.String[] args)(package private) static voidprintStats(long total_time, int num)(package private) voidsendMessages(int num)voidstart()voidviewAccepted(View new_view)Called when a change in membership has occurred.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jgroups.Receiver
block, getState, receive, receive, setState, unblock
-
Methods inherited from interface org.jgroups.blocks.RequestHandler
handle
-
-
-
-
Field Detail
-
channel
JChannel channel
-
disp
MessageDispatcher disp
-
props
java.lang.String props
-
server
boolean server
-
num
int num
-
received
int received
-
TIMEOUT
static final long TIMEOUT
- See Also:
- Constant Field Values
-
-
Method Detail
-
handle
public java.lang.Object handle(Message msg) throws java.lang.Exception
Description copied from interface:RequestHandlerProcesses a request synchronously, ie. on the thread invoking this handler- Specified by:
handlein interfaceRequestHandler- Parameters:
msg- the message containing the request- Returns:
- the object, rceeived as result, or null (void method)
- Throws:
java.lang.Exception
-
start
public void start() throws java.lang.Exception- Throws:
java.lang.Exception
-
sendMessages
void sendMessages(int num) throws java.lang.Exception- Throws:
java.lang.Exception
-
printStats
static void printStats(long total_time, int num)
-
viewAccepted
public void viewAccepted(View new_view)
Description copied from interface:ReceiverCalled when a change in membership has occurred. No long running actions, sending of messages or anything that could block should be done in this callback. If some long running action needs to be performed, it should be done in a separate thread.
Note that on reception of the first view (a new member just joined), the channel will not yet be in the connected state. This only happens whenJChannel.connect(String)returns.- Specified by:
viewAcceptedin interfaceReceiver
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception- Throws:
java.lang.Exception
-
help
static void help()
-
-