KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > management > server > ServerConnectorMXBean


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  *
23  * Free Software Foundation, Inc.
24  * 59 Temple Place, Suite 330
25  * Boston, MA 02111-1307 USA
26  *
27  * @author Scott Ferguson
28  */

29
30 package com.caucho.management.server;
31
32 import com.caucho.jmx.Description;
33 import com.caucho.jmx.Units;
34
35 import java.util.Date JavaDoc;
36
37 /**
38  * A client-view of a cluster's server. The load balancer and
39  * persistent store will use the ClusterClient to communicate to
40  * other servers in the cluster.
41  *
42  * The JMX name looks like:
43  * <pre>
44  * resin:type=ServerConnectorn,name=web-a
45  * </pre>
46  */

47 @Description("Client-view of a cluster's server, i.e. a target server with which this instance can communicate")
48 public interface ServerConnectorMXBean extends ManagedObjectMXBean {
49   /**
50    * The containing cluster.
51    */

52   @Description("The configured Cluster which contains the server")
53   public ClusterMXBean getCluster();
54
55   /**
56    * The cluster index of the server.
57    */

58   @Description("The configured index of this server in the cluster, used for distributed objects.")
59   public int getClusterIndex();
60
61   /**
62    * The timeout in milliseconds for connecting to the server.
63    */

64   @Description("The configured timeout for a client connect to the server")
65   @Units("milliseconds")
66   public long getConnectTimeout();
67
68   /**
69    * Returns the ip address or host name of the server.
70    */

71   @Description("The configured IP address or host name of the server")
72   public String JavaDoc getAddress();
73
74   /**
75    * Returns the resin/admin port number of the server.
76    */

77   @Description("The configured port number of the target server")
78   public int getPort();
79
80   /**
81    * Returns the timeout for assuming a target server remains unavailable once
82    * a connection attempt fails. When the timeout period elapses another attempt
83    * is made to connect to the target server
84    */

85   @Description("The configured timeout for assuming a target server remains" +
86           " unavailable once a connection attempt fails." +
87           " When the timeout period elapses another" +
88           " attempt is made to connect to the target server")
89   @Units("milliseconds")
90   public long getRecoverTime();
91
92   /**
93    * Returns the timeout for an idle socket that is connected to the target
94    * server. If the socket is not used within the timeout period the idle
95    * connection is closed.
96    */

97   @Description("The configured timeout for an idle socket that is connected" +
98                " to the target server. If the socket is not" +
99            " used within the timeout period the idle" +
100            " connection is closed")
101   @Units("milliseconds")
102   public long getIdleTime();
103
104   /**
105    * Returns the timeout to use for reads when communicating with
106    * the target server.
107    */

108   @Description("The configured timeout for a client read from the server")
109   @Units("milliseconds")
110   public long getSocketTimeout();
111
112   /**
113    * Returns the warmup time in milliseconds.
114    */

115   @Description("The configured warmup time in milliseconds for ramping up connections to the server")
116   @Units("milliseconds")
117   public long getWarmupTime();
118
119   /**
120    * Returns the load-balancer weight, defaulting to 100.
121    *
122    */

123   @Description("The configured load balance weight. Weights over 100 will get more traffic and weights less than 100 will get less traffic")
124   public int getWeight();
125
126   //
127
// State attributes
128
//
129

130   /**
131    * Returns the lifecycle state.
132    */

133   @Description("The current lifecycle state of the client")
134   public String JavaDoc getState();
135
136   //
137
// Statistics attributes
138
//
139

140   /**
141    * Returns the number of connections actively being used to communicate with
142    * the target server.
143    */

144   @Description("The current number of connections actively being used" +
145                " to communicate with the target server")
146   public int getConnectionActiveCount();
147
148   /**
149    * Returns the number of open but currently unused connections to the
150    * target server.
151    */

152   @Description("The current number of idle connections in the connection pool")
153   public int getConnectionIdleCount();
154
155   /**
156    * Returns the number of connections that have been made to the target server.
157    */

158   @Description("The total number of new connections that have been made" +
159            " to the target server")
160   public long getConnectionNewCountTotal();
161
162   /**
163    * Returns the number of connections that have been made to the target server.
164    */

165   @Description("The total number of keepalive connections that have been made" +
166            " to the target server")
167   public long getConnectionKeepaliveCountTotal();
168
169   /**
170    * Returns the number of connections which could not connect
171    * to the target server.
172    */

173   @Description("The total number of failed connections attempts" +
174            " to the target server")
175   public long getConnectionFailCountTotal();
176
177   /**
178    * Returns the time of the last failure.
179    */

180   @Description("The current last time a connection attempt failed")
181   public Date JavaDoc getLastFailTime();
182
183   /**
184    * Returns the number of connections which resulted in a busy
185    * response.
186    */

187   @Description("The total number of busy responses" +
188            " from the target server")
189   public long getConnectionBusyCountTotal();
190
191   /**
192    * Returns the last time of the busy response.
193    */

194   @Description("The current last time the target server refused a request because it was busy")
195   public Date JavaDoc getLastBusyTime();
196
197   /**
198    * Returns the server's load average.
199    */

200   @Description("The load average of the backend server")
201   public double getServerCpuLoadAvg();
202
203   /**
204    * Enables connections to the target server.
205    */

206   @Description("Enables connections to the target server")
207   public void start();
208
209   /**
210    * Enables connections to the target server.
211    */

212   @Description("Enable only sticky-session requests to the target server")
213   public void enableSessionOnly();
214
215   /**
216    * Disables connections to the target server.
217    */

218   @Description("Disables connections to the target server")
219   public void stop();
220
221   /**
222    * Returns true if a connection can be made to the target server.
223    */

224   @Description("Tries to connect to the target server, returning true if successful")
225   public boolean ping();
226 }
227
Popular Tags