KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > catalina > cluster > MembershipService


1 /*
2  * Copyright 1999,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.catalina.cluster;
18
19 /**
20  * The membership service helps the cluster determine the membership
21  * logic in the cluster.
22  * @author Filip Hanik
23  * @version $Revision: 1.5 $, $Date: 2004/05/26 16:31:27 $
24  */

25
26
27 public interface MembershipService {
28
29     /**
30      * Sets the properties for the membership service. This must be called before
31      * the <code>start()</code> method is called.
32      * The properties are implementation specific.
33      * @param properties - to be used to configure the membership service.
34      */

35     public void setProperties(java.util.Properties JavaDoc properties);
36     /**
37      * Returns the properties for the configuration used.
38      */

39     public java.util.Properties JavaDoc getProperties();
40     /**
41      * Starts the membership service. If a membership listeners is added
42      * the listener will start to receive membership events.
43      * Performs a start level 1 and 2
44      * @throws java.lang.Exception if the service fails to start.
45      */

46     public void start() throws java.lang.Exception JavaDoc;
47
48     /**
49      * Starts the membership service. If a membership listeners is added
50      * the listener will start to receive membership events.
51      * @param level - level 1 starts listening for members, level 2
52      * starts broad casting the server
53      * @throws java.lang.Exception if the service fails to start.
54      */

55     public void start(int level) throws java.lang.Exception JavaDoc;
56
57
58     /**
59      * Stops the membership service
60      */

61     public void stop();
62     /**
63      * Returns a list of all the members in the cluster.
64      */

65     public Member[] getMembers();
66     /**
67      * Returns the member object that defines this member
68      */

69     public Member getLocalMember();
70
71     /**
72      * Sets the local member properties for broadcasting
73      */

74     public void setLocalMemberProperties(String JavaDoc listenHost, int listenPort);
75     /**
76      * Sets the membership listener, only one listener can be added.
77      * If you call this method twice, the last listener will be used.
78      * @param listener The listener
79      */

80     public void addMembershipListener(MembershipListener listener);
81     /**
82      * removes the membership listener.
83      */

84     public void removeMembershipListener();
85
86 }
87
Popular Tags