01: package org.jgroups.tests.perf;
02:
03: import java.util.Properties;
04: import java.util.Map;
05:
06: /**
07: * Generic transport abstraction for all different transports (JGroups, JMS, UDP, TCP). The lifecycle is
08: * <ol>
09: * <li>Create an instance of the transport (using the empty constructor)
10: * <li>Call <code>create()</code>
11: * <li>Possibly call <code>setReceiver()</code>
12: * <li>Call <code>start()</code>
13: * <li>Call <code>send()</code>
14: * <li>Call <code>stop()</stop>
15: * <li>Call <code>destroy()</code> (alternatively call <code>start()</code> again)
16: * </ol>
17: * @author Bela Ban Jan 22
18: * @author 2004
19: * @version $Id: Transport.java,v 1.3 2005/07/26 11:50:22 belaban Exp $
20: */
21: public interface Transport {
22:
23: /** Create the transport */
24: void create(Properties properties) throws Exception;
25:
26: /** Get the local address (= endpoint) of this transport. Guaranteed to be called <em>after</em>
27: * <code>create()</code>, possibly even later (after <code>start()</code>) */
28: Object getLocalAddress();
29:
30: /** Start the transport */
31: void start() throws Exception;
32:
33: /** Stop the transport */
34: void stop();
35:
36: /** Destroy the transport. Transport cannot be reused after this call, but a new instance has to be created */
37: void destroy();
38:
39: /** Set the receiver */
40: void setReceiver(Receiver r);
41:
42: Map dumpStats();
43:
44: /**
45: * Send a message
46: * @param destination A destination. If null, send a message to all members
47: * @param payload A buffer to be sent
48: * @throws Exception
49: */
50: void send(Object destination, byte[] payload) throws Exception;
51: }
|