001: /*
002: * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003: *
004: * This file is part of Resin(R) Open Source
005: *
006: * Each copy or derived work must preserve the copyright notice and this
007: * notice unmodified.
008: *
009: * Resin Open Source is free software; you can redistribute it and/or modify
010: * it under the terms of the GNU General Public License as published by
011: * the Free Software Foundation; either version 2 of the License, or
012: * (at your option) any later version.
013: *
014: * Resin Open Source is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017: * of NON-INFRINGEMENT. See the GNU General Public License for more
018: * details.
019: *
020: * You should have received a copy of the GNU General Public License
021: * along with Resin Open Source; if not, write to the
022: *
023: * Free Software Foundation, Inc.
024: * 59 Temple Place, Suite 330
025: * Boston, MA 02111-1307 USA
026: *
027: * @author Scott Ferguson
028: */
029:
030: package com.caucho.management.server;
031:
032: import com.caucho.jmx.Description;
033: import com.caucho.jmx.Units;
034:
035: import java.util.Date;
036:
037: /**
038: * A client-view of a cluster's server. The load balancer and
039: * persistent store will use the ClusterClient to communicate to
040: * other servers in the cluster.
041: *
042: * The JMX name looks like:
043: * <pre>
044: * resin:type=ServerConnectorn,name=web-a
045: * </pre>
046: */
047: @Description("Client-view of a cluster's server, i.e. a target server with which this instance can communicate")
048: public interface ServerConnectorMXBean extends ManagedObjectMXBean {
049: /**
050: * The containing cluster.
051: */
052: @Description("The configured Cluster which contains the server")
053: public ClusterMXBean getCluster();
054:
055: /**
056: * The cluster index of the server.
057: */
058: @Description("The configured index of this server in the cluster, used for distributed objects.")
059: public int getClusterIndex();
060:
061: /**
062: * The timeout in milliseconds for connecting to the server.
063: */
064: @Description("The configured timeout for a client connect to the server")
065: @Units("milliseconds")
066: public long getConnectTimeout();
067:
068: /**
069: * Returns the ip address or host name of the server.
070: */
071: @Description("The configured IP address or host name of the server")
072: public String getAddress();
073:
074: /**
075: * Returns the resin/admin port number of the server.
076: */
077: @Description("The configured port number of the target server")
078: public int getPort();
079:
080: /**
081: * Returns the timeout for assuming a target server remains unavailable once
082: * a connection attempt fails. When the timeout period elapses another attempt
083: * is made to connect to the target server
084: */
085: @Description("The configured timeout for assuming a target server remains" + " unavailable once a connection attempt fails." + " When the timeout period elapses another"+ " attempt is made to connect to the target server")
086: @Units("milliseconds")
087: public long getRecoverTime();
088:
089: /**
090: * Returns the timeout for an idle socket that is connected to the target
091: * server. If the socket is not used within the timeout period the idle
092: * connection is closed.
093: */
094: @Description("The configured timeout for an idle socket that is connected" + " to the target server. If the socket is not" + " used within the timeout period the idle"+ " connection is closed")
095: @Units("milliseconds")
096: public long getIdleTime();
097:
098: /**
099: * Returns the timeout to use for reads when communicating with
100: * the target server.
101: */
102: @Description("The configured timeout for a client read from the server")
103: @Units("milliseconds")
104: public long getSocketTimeout();
105:
106: /**
107: * Returns the warmup time in milliseconds.
108: */
109: @Description("The configured warmup time in milliseconds for ramping up connections to the server")
110: @Units("milliseconds")
111: public long getWarmupTime();
112:
113: /**
114: * Returns the load-balancer weight, defaulting to 100.
115: *
116: */
117: @Description("The configured load balance weight. Weights over 100 will get more traffic and weights less than 100 will get less traffic")
118: public int getWeight();
119:
120: //
121: // State attributes
122: //
123:
124: /**
125: * Returns the lifecycle state.
126: */
127: @Description("The current lifecycle state of the client")
128: public String getState();
129:
130: //
131: // Statistics attributes
132: //
133:
134: /**
135: * Returns the number of connections actively being used to communicate with
136: * the target server.
137: */
138: @Description("The current number of connections actively being used" + " to communicate with the target server")
139: public int getConnectionActiveCount();
140:
141: /**
142: * Returns the number of open but currently unused connections to the
143: * target server.
144: */
145: @Description("The current number of idle connections in the connection pool")
146: public int getConnectionIdleCount();
147:
148: /**
149: * Returns the number of connections that have been made to the target server.
150: */
151: @Description("The total number of new connections that have been made" + " to the target server")
152: public long getConnectionNewCountTotal();
153:
154: /**
155: * Returns the number of connections that have been made to the target server.
156: */
157: @Description("The total number of keepalive connections that have been made" + " to the target server")
158: public long getConnectionKeepaliveCountTotal();
159:
160: /**
161: * Returns the number of connections which could not connect
162: * to the target server.
163: */
164: @Description("The total number of failed connections attempts" + " to the target server")
165: public long getConnectionFailCountTotal();
166:
167: /**
168: * Returns the time of the last failure.
169: */
170: @Description("The current last time a connection attempt failed")
171: public Date getLastFailTime();
172:
173: /**
174: * Returns the number of connections which resulted in a busy
175: * response.
176: */
177: @Description("The total number of busy responses" + " from the target server")
178: public long getConnectionBusyCountTotal();
179:
180: /**
181: * Returns the last time of the busy response.
182: */
183: @Description("The current last time the target server refused a request because it was busy")
184: public Date getLastBusyTime();
185:
186: /**
187: * Returns the server's load average.
188: */
189: @Description("The load average of the backend server")
190: public double getServerCpuLoadAvg();
191:
192: /**
193: * Returns the server's latency factory
194: */
195: @Description("The latency factor of the backend server")
196: public double getLatencyFactor();
197:
198: /**
199: * Enables connections to the target server.
200: */
201: @Description("Enables connections to the target server")
202: public void start();
203:
204: /**
205: * Enables connections to the target server.
206: */
207: @Description("Enable only sticky-session requests to the target server")
208: public void enableSessionOnly();
209:
210: /**
211: * Disables connections to the target server.
212: */
213: @Description("Disables connections to the target server")
214: public void stop();
215:
216: /**
217: * Returns true if a connection can be made to the target server.
218: */
219: @Description("Tries to connect to the target server, returning true if successful")
220: public boolean ping();
221: }
|