01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package org.apache.catalina.tribes;
19:
20: /**
21: * ChannelReceiver Interface<br>
22: * The <code>ChannelSender</code> interface is the data sender component
23: * at the bottom layer, the IO layer (for layers see the javadoc for the {@link Channel} interface).<br>
24: * The channel sender must support "silent" members, ie, be able to send a message to a member
25: * that is not in the membership, but is part of the destination parameter
26: * @author Filip Hanik
27: * @version $Revision: 467222 $, $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $
28: */
29: public interface ChannelSender extends Heartbeat {
30: /**
31: * Notify the sender of a member being added to the group.<br>
32: * Optional. This can be an empty implementation, that does nothing
33: * @param member Member
34: */
35: public void add(Member member);
36:
37: /**
38: * Notification that a member has been removed or crashed.
39: * Can be used to clean up open connections etc
40: * @param member Member
41: */
42: public void remove(Member member);
43:
44: /**
45: * Start the channel sender
46: * @throws IOException if preprocessing takes place and an error happens
47: */
48: public void start() throws java.io.IOException;
49:
50: /**
51: * Stop the channel sender
52: */
53: public void stop();
54:
55: /**
56: * A channel heartbeat, use this method to clean up resources
57: */
58: public void heartbeat();
59:
60: /**
61: * Send a message to one or more recipients.
62: * @param message ChannelMessage - the message to be sent
63: * @param destination Member[] - the destinations
64: * @throws ChannelException - if an error happens, the ChannelSender MUST report
65: * individual send failures on a per member basis, using ChannelException.addFaultyMember
66: * @see ChannelException#addFaultyMember(Member,java.lang.Exception)
67: */
68: public void sendMessage(ChannelMessage message, Member[] destination)
69: throws ChannelException;
70: }
|