1 /*
2 * Copyright (c) 1998-2002 The Jgroup Team.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16 *
17 */
18
19 package jgroup.relacs.simulator;
20
21 import java.net.InetAddress;
22 import java.rmi.Remote;
23 import java.rmi.RemoteException;
24 import java.util.Map;
25
26 /**
27 * <code>SocketStatus</code> is a remote interface for assigning
28 * probabilities to channels in the distributed system.
29 *
30 * @author Alberto Montresor
31 * @author Hein Meling
32 * @since Jgroup 0.5 (revised Jgroup 2.2)
33 */
34 public interface SocketStatus
35 extends Remote
36 {
37
38 ////////////////////////////////////////////////////////////////////////////////////////////
39 // Constants
40 ////////////////////////////////////////////////////////////////////////////////////////////
41
42 /** Reliable channel */
43 public static final int BASE = 100;
44
45 /** Registry lookup name */
46 public static final String SOCKET_STATUS = "SocketStatus";
47
48
49 ////////////////////////////////////////////////////////////////////////////////////////////
50 // Methods
51 ////////////////////////////////////////////////////////////////////////////////////////////
52
53 /**
54 * Register the given socket status object with this socket status
55 * implementation, so as to notify the other socket status instances
56 * of changes to the reachability pattern.
57 */
58 public void register(SocketStatus sStatus)
59 throws RemoteException;
60
61 /**
62 * This method must be invoked before the current reachability
63 * pattern will be activated. That is, after invoking a series of
64 * <code>setStatus</code> methods, an invocation of this method
65 * will activate the newly set reachability pattern.
66 */
67 public void commit()
68 throws RemoteException;
69
70 /**
71 * Notifies any registered socket status implementations of the most
72 * recently commited reachability pattern of the local socket status
73 * instance. This can be used by socket status instances running in a JVM
74 * separate from the BootstrapRegistry.
75 */
76 public void notifyStatus(Map<InetAddress,Integer> commitedLinks)
77 throws RemoteException;
78
79 /**
80 * Returns the content of the current socket status object. This is used
81 * to obtain the state of a socket status object running in another JVM on
82 * the local machine.
83 */
84 public Map<InetAddress,Integer> getStatus()
85 throws RemoteException;
86
87 /**
88 * Set the probability of a datagram packet to be correctly delivered
89 * at the host identified by <code>inet</code>. The probability is
90 * defined as <code>prob</code> / <code>BASE</code>.
91 */
92 public void setStatus(InetAddress inet, int prob)
93 throws RemoteException;
94
95 } // END of SocketStatus