KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jgroups > tests > perf > Transport


1 package org.jgroups.tests.perf;
2
3 import java.util.Properties JavaDoc;
4
5 /**
6  * Generic transport abstraction for all different transports (JGroups, JMS, UDP, TCP). The lifecycle is
7  * <ol>
8  * <li>Create an instance of the transport (using the empty constructor)
9  * <li>Call <code>create()</code>
10  * <li>Possibly call <code>setReceiver()</code>
11  * <li>Call <code>start()</code>
12  * <li>Call <code>send()</code>
13  * <li>Call <code>stop()</stop>
14  * <li>Call <code>destroy()</code> (alternatively call <code>start()</code> again)
15  * </ol>
16  * @author Bela Ban Jan 22
17  * @author 2004
18  * @version $Id: Transport.java,v 1.2 2004/01/24 16:56:36 belaban Exp $
19  */

20 public interface Transport {
21
22     /** Create the transport */
23     void create(Properties JavaDoc properties) throws Exception JavaDoc;
24
25     /** Get the local address (= endpoint) of this transport. Guaranteed to be called <em>after</em>
26      * <code>create()</code>, possibly even later (after <code>start()</code>) */

27     Object JavaDoc getLocalAddress();
28
29     /** Start the transport */
30     void start() throws Exception JavaDoc;
31
32     /** Stop the transport */
33     void stop();
34
35     /** Destroy the transport. Transport cannot be reused after this call, but a new instance has to be created */
36     void destroy();
37
38     /** Set the receiver */
39     void setReceiver(Receiver r);
40
41     /**
42      * Send a message
43      * @param destination A destination. If null, send a message to all members
44      * @param payload A buffer to be sent
45      * @throws Exception
46      */

47     void send(Object JavaDoc destination, byte[] payload) throws Exception JavaDoc;
48 }
49
Popular Tags