1 /*
2 * Copyright 2006 Simon Raess
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 package net.sf.beep4j;
17
18 /**
19 * Callback interface for channel close operation. When a BEEP peer
20 * wants to close a channel it sends a close channel request to the
21 * other peer. The other peer can either accept the request or
22 * decline it. A declined request has the effect that the channel
23 * is still alive. There is no way to close a channel for sure.
24 *
25 * @author Simon Raess
26 */
27 public interface CloseChannelCallback {
28
29 /**
30 * Invoked by the framework if the channel close request has
31 * been accepted. Beside this method, the framework
32 * also invokes the {@link ChannelHandler#channelClosed(Channel)}
33 * method.
34 */
35 void closeAccepted();
36
37 /**
38 * Invoked by the framework if the channel close request has
39 * been declined. The code and message convey the reason
40 * why the request has been declined.
41 *
42 * @param code the code, which is meaningful to a program
43 * @param message the message, which is meaningful to humans
44 */
45 void closeDeclined(int code, String message);
46
47 }