2362N/A * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * Defines generic behaviour for the server 0N/A * part of a connector or an adaptor. Most connectors or adaptors extend <CODE>CommunicatorServer</CODE> 0N/A * and inherit this behaviour. Connectors or adaptors that do not fit into this model do not extend 0N/A * <CODE>CommunicatorServer</CODE>. 0N/A * An <CODE>CommunicatorServer</CODE> is an active object, it listens for client requests 0N/A * and processes them in its own thread. When necessary, a <CODE>CommunicatorServer</CODE> 0N/A * creates other threads to process multiple requests concurrently. 0N/A * A <CODE>CommunicatorServer</CODE> object can be stopped by calling the <CODE>stop</CODE> 0N/A * method. When it is stopped, the <CODE>CommunicatorServer</CODE> no longer listens to client 0N/A * requests and no longer holds any thread or communication resources. 0N/A * It can be started again by calling the <CODE>start</CODE> method. 0N/A * A <CODE>CommunicatorServer</CODE> has a <CODE>state</CODE> property which reflects its 0N/A * <TR><TH>CommunicatorServer</TH> <TH>State</TH></TR> 0N/A * <TR><TD><CODE>stopped</CODE></TD> <TD><CODE>OFFLINE</CODE></TD></TR> 0N/A * <TR><TD><CODE>starting</CODE></TD> <TD><CODE>STARTING</CODE></TD></TR> 0N/A * <TR><TD><CODE>running</CODE></TD> <TD><CODE>ONLINE</CODE></TD></TR> 0N/A * <TR><TD><CODE>stopping</CODE></TD> <TD><CODE>STOPPING</CODE></TD></TR> 0N/A * The <CODE>STARTING</CODE> state marks the transition from <CODE>OFFLINE</CODE> to 0N/A * <CODE>ONLINE</CODE>. 0N/A * The <CODE>STOPPING</CODE> state marks the transition from <CODE>ONLINE</CODE> to 0N/A * <CODE>OFFLINE</CODE>. This occurs when the <CODE>CommunicatorServer</CODE> is 0N/A * finishing or interrupting active requests. 0N/A * A <CODE>CommunicatorServer</CODE> may serve several clients concurrently. The 0N/A * number of concurrent clients can be limited using the property 0N/A * <CODE>maxActiveClientCount</CODE>. The default value of this property is 0N/A * defined by the subclasses. 0N/A * When a <CODE>CommunicatorServer</CODE> is unregistered from the MBeanServer, 0N/A * it is stopped automatically. 0N/A * <p><b>This API is a Sun Microsystems internal API and is subject 0N/A * to change without notice.</b></p> 0N/A * Starts this <CODE>CommunicatorServer</CODE>. 0N/A * Has no effect if this <CODE>CommunicatorServer</CODE> is <CODE>ONLINE</CODE> or 0N/A * <CODE>STOPPING</CODE>. 0N/A * Stops this <CODE>CommunicatorServer</CODE>. 0N/A * Has no effect if this <CODE>CommunicatorServer</CODE> is <CODE>OFFLINE</CODE> or 0N/A * <CODE>STOPPING</CODE>. 0N/A * Tests if the <CODE>CommunicatorServer</CODE> is active. 0N/A * @return True if connector is <CODE>ONLINE</CODE>; false otherwise. 0N/A * Waits untill either the State attribute of this MBean equals the specified <VAR>state</VAR> parameter, 0N/A * or the specified <VAR>timeOut</VAR> has elapsed. The method <CODE>waitState</CODE> returns with a boolean value indicating whether 0N/A * the specified <VAR>state</VAR> parameter equals the value of this MBean's State attribute at the time the method terminates. 0N/A * Two special cases for the <VAR>timeOut</VAR> parameter value are: 0N/A * <UL><LI> if <VAR>timeOut</VAR> is negative then <CODE>waitState</CODE> returns immediately (i.e. does not wait at all),</LI> 0N/A * <LI> if <VAR>timeOut</VAR> equals zero then <CODE>waitState</CODE> waits untill the value of this MBean's State attribute 0N/A * is the same as the <VAR>state</VAR> parameter (i.e. will wait indefinitely if this condition is never met).</LI></UL> 0N/A * @param state The value of this MBean's State attribute 0N/A * to wait for. <VAR>state</VAR> can be one of: 0N/A * <li><CODE>CommunicatorServer.OFFLINE</CODE>,</li> 0N/A * <li><CODE>CommunicatorServer.ONLINE</CODE>,</li> 0N/A * <li><CODE>CommunicatorServer.STARTING</CODE>,</li> 0N/A * <li><CODE>CommunicatorServer.STOPPING</CODE>.</li> 0N/A * @param timeOut The maximum time to wait for, in 0N/A * milliseconds, if positive. 0N/A * Infinite time out if 0, or no waiting at all if negative. 0N/A * @return true if the value of this MBean's State attribute is the 0N/A * same as the <VAR>state</VAR> parameter; false otherwise. 0N/A * Gets the state of this <CODE>CommunicatorServer</CODE> as an integer. 0N/A * @return <CODE>ONLINE</CODE>, <CODE>OFFLINE</CODE>, <CODE>STARTING</CODE> or <CODE>STOPPING</CODE>. 0N/A * Gets the state of this <CODE>CommunicatorServer</CODE> as a string. 0N/A * @return One of the strings "ONLINE", "OFFLINE", "STARTING" or "STOPPING". 0N/A * Gets the host name used by this <CODE>CommunicatorServer</CODE>. 0N/A * @return The host name used by this <CODE>CommunicatorServer</CODE>. 0N/A * Gets the port number used by this <CODE>CommunicatorServer</CODE>. 0N/A * @return The port number used by this <CODE>CommunicatorServer</CODE>. 0N/A * Sets the port number used by this <CODE>CommunicatorServer</CODE>. 0N/A * @param port The port number used by this <CODE>CommunicatorServer</CODE>. 0N/A * @exception java.lang.IllegalStateException This method has been invoked 0N/A * while the communicator was ONLINE or STARTING. 0N/A * Gets the protocol being used by this <CODE>CommunicatorServer</CODE>. 0N/A * @return The protocol as a string.