01: /*
02: * Copyright 1999,2004 The Apache Software Foundation.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: public interface MembershipService {
27:
28: /**
29: * Sets the properties for the membership service. This must be called before
30: * the <code>start()</code> method is called.
31: * The properties are implementation specific.
32: * @param properties - to be used to configure the membership service.
33: */
34: public void setProperties(java.util.Properties properties);
35:
36: /**
37: * Returns the properties for the configuration used.
38: */
39: public java.util.Properties getProperties();
40:
41: /**
42: * Starts the membership service. If a membership listeners is added
43: * the listener will start to receive membership events.
44: * Performs a start level 1 and 2
45: * @throws java.lang.Exception if the service fails to start.
46: */
47: public void start() throws java.lang.Exception;
48:
49: /**
50: * Starts the membership service. If a membership listeners is added
51: * the listener will start to receive membership events.
52: * @param level - level 1 starts listening for members, level 2
53: * starts broad casting the server
54: * @throws java.lang.Exception if the service fails to start.
55: */
56: public void start(int level) throws java.lang.Exception;
57:
58: /**
59: * Stops the membership service
60: */
61: public void stop();
62:
63: /**
64: * Returns a list of all the members in the cluster.
65: */
66: public Member[] getMembers();
67:
68: /**
69: * Returns the member object that defines this member
70: */
71: public Member getLocalMember();
72:
73: /**
74: * Sets the local member properties for broadcasting
75: */
76: public void setLocalMemberProperties(String listenHost,
77: int listenPort);
78:
79: /**
80: * Sets the membership listener, only one listener can be added.
81: * If you call this method twice, the last listener will be used.
82: * @param listener The listener
83: */
84: public void addMembershipListener(MembershipListener listener);
85:
86: /**
87: * removes the membership listener.
88: */
89: public void removeMembershipListener();
90:
91: }
|