KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > tribe > faultdetection > FaultDetectionService


1 /**
2  * Tribe: Group communication library.
3  * Copyright (C) 2004 French National Institute For Research In Computer
4  * Science And Control (INRIA).
5  * Contact: tribe@objectweb.org
6  *
7  * This library is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as published by the
9  * Free Software Foundation; either version 2.1 of the License, or any later
10  * version.
11  *
12  * This library is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15  * for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this library; if not, write to the Free Software Foundation,
19  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20  *
21  * Initial developer(s): Nicolas Modrzyk.
22  * Contributor(s): ______________________.
23  */

24
25 package org.objectweb.tribe.faultdetection;
26
27 import java.util.ArrayList JavaDoc;
28
29 import org.objectweb.tribe.common.Group;
30 import org.objectweb.tribe.common.Member;
31
32 /**
33  * This class defines a FaultDetectionService
34  *
35  * @author <a HREF="mailto:Nicolas.Modrzyk@inrialpes.fr">Nicolas Modrzyk </a>
36  * @version 1.0
37  */

38 public interface FaultDetectionService
39 {
40   /**
41    * Default refresh value
42    */

43   static final int DEFAULT_REFREST_RATE = 1000;
44   
45   /**
46    * The default port for fault detection check
47    */

48   static final int DEFAULT_LISTENING_PORT = 6456;
49   
50   /**
51    * The default emitting port for fault detection check
52    */

53   static final int DEFAULT_EMITTING_PORT = 6457;
54
55   /**
56    * The intervals to check for new or lost members
57    *
58    * @param delay <code>long</code> value in milliseconds
59    */

60   void setRefreshRate(long delay);
61
62   /**
63    * Return the value used for refresh rate. If no value has been set, a default
64    * value is used.
65    *
66    * @return <code>long</code> value in milliseconds
67    * @see DEFAULT_REFREST_RATE
68    */

69   long getRefreshRate();
70
71   /**
72    * Add a group to analyse
73    *
74    * @param group <code>Group</code> object that contains the members to
75    * listen to
76    */

77   void addGroup(Group group);
78   
79   /**
80    * Add a member to the ping service
81    *
82    * @param member <code>Member</code> to listen to
83    */

84   void addMember(Member member);
85   
86   /**
87    * Remove this member from the service
88    *
89    * @param member <code>Member</code> to stop listening to
90    */

91   void removeMember(Member member);
92
93   /**
94    * Stop detecting failure for this group
95    *
96    * @param group <code>Group</code> object that contains the members to
97    * listen to
98    * @return group if the group was listened to before, null if no changes has
99    * been made.
100    */

101   Group removeGroup(Group group);
102
103   /**
104    * Access all the groups the service is listening to. This is the original
105    * list of groups so any changes to this list will effectivel change the
106    * groups we are analysing
107    *
108    * @return an <code>ArrayList</code> of <code>Group</code>
109    */

110   ArrayList JavaDoc getGroups();
111   
112   /**
113    * Add a listener of event
114    *
115    * @param listener <code>FaultDetectionListener</code> to send notification to
116    */

117   void addListener(FaultDetectionListener listener);
118   
119   /**
120    * Tell the fault service to no more send event to the listener
121    *
122    * @param listener <code>FaultDetectionListener</code> to send notification to
123    */

124   void removeListener(FaultDetectionListener listener);
125 }
Popular Tags