KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > activemq > broker > Connection


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

18 package org.apache.activemq.broker;
19
20 import java.io.IOException JavaDoc;
21
22 import org.apache.activemq.Service;
23 import org.apache.activemq.broker.region.ConnectionStatistics;
24 import org.apache.activemq.command.Command;
25 import org.apache.activemq.command.Response;
26
27 /**
28  *
29  * @version $Revision: 1.5 $
30  */

31 public interface Connection extends Service {
32
33     /**
34      * @return the connector that created this connection.
35      */

36     public Connector getConnector();
37
38     /**
39      * Sends a message to the client.
40      *
41      * @param message
42      * the message to send to the client.
43      */

44     public void dispatchSync(Command message);
45
46     /**
47      * Sends a message to the client.
48      *
49      * @param command
50      */

51     public void dispatchAsync(Command command);
52
53     /**
54      * Services a client command and submits it to the broker.
55      *
56      * @param command
57      */

58     public Response service(Command command);
59
60     /**
61      * Handles an unexpected error associated with a connection.
62      *
63      * @param error
64      */

65     public void serviceException(Throwable JavaDoc error);
66
67     /**
68      * @return true if the Connection is slow
69      */

70     public boolean isSlow();
71
72     /**
73      * @return if after being marked, the Connection is still writing
74      */

75     public boolean isBlocked();
76
77     /**
78      * @return true if the Connection is connected
79      */

80     public boolean isConnected();
81
82     /**
83      * @return true if the Connection is active
84      */

85     public boolean isActive();
86
87     /**
88      * Returns the number of messages to be dispatched to this connection
89      */

90     public int getDispatchQueueSize();
91     
92     /**
93      * Returns the statistics for this connection
94      */

95     public ConnectionStatistics getStatistics();
96     
97     /**
98      * @return true if the Connection will process control commands
99      */

100     public boolean isManageable();
101
102     /**
103      * @return the source address for this connection
104      */

105     public String JavaDoc getRemoteAddress();
106
107     public void serviceExceptionAsync(IOException JavaDoc e);
108     
109     public String JavaDoc getConnectionId();
110
111 }
112
Popular Tags