[jboss-cvs] JBossAS SVN: r76260 - trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/mcmp.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Jul 27 14:06:56 EDT 2008


Author: bstansberry at jboss.com
Date: 2008-07-27 14:06:56 -0400 (Sun, 27 Jul 2008)
New Revision: 76260

Modified:
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/mcmp/MCMPHandler.java
Log:
[JBAS-5659] Add method for sending multiple requests; rationalize method names; add javadoc

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/mcmp/MCMPHandler.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/mcmp/MCMPHandler.java	2008-07-27 18:04:48 UTC (rev 76259)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/mcmp/MCMPHandler.java	2008-07-27 18:06:56 UTC (rev 76260)
@@ -24,6 +24,7 @@
 
 import java.io.IOException;
 import java.net.InetAddress;
+import java.util.List;
 import java.util.Set;
 
 import org.jboss.web.tomcat.service.modcluster.config.MCMPHandlerConfiguration;
@@ -36,28 +37,163 @@
  */
 public interface MCMPHandler
 {  
+   /** Gets this handler's configuration */
    MCMPHandlerConfiguration getConfiguration();
    
+   /** Initialize the handler */
    void init();
+   
+   /** Perform any shut down work. */
    void shutdown();
    
+   /** 
+    * Send a request to all healthy proxies.
+    * 
+    * @param request the request. Cannot be <code>null</code>
+    **/
    void sendRequest(MCMPRequest request);
    
+   /** 
+    * Send a list of requests to all healthy proxies, with all requests
+    * in the list sent to each proxy before moving on to the next.
+    * 
+    * @param requests the requests. Cannot be <code>null</code>
+    */
+   void sendRequests(List<MCMPRequest> requests);
+   
+   /**
+    * Add a proxy to the list of those with which this handler communicates.
+    * Communication does not begin until the next call to {@link #status()}.
+    * 
+    * @param address a string in the form hostname:port, where the hostname
+    *                portion is suitable for passing to <code>InetAddress.getByHost(...)</code>
+    */
    void addProxy(String address);
+   
+   /**
+    * Add a proxy to the list of those with which this handler communicates.
+    * Communication does not begin until the next call to {@link #status()}.
+    * 
+    * @param host the hostname of the proxy; a string suitable for passing to 
+    *             <code>InetAddress.getByHost(...)</code> 
+    * @param port the port on which the proxy listens for MCMP requests
+    */
    void addProxy(String host, int port);
+   
+   /**
+    * Add a proxy to the list of those with which this handler communicates.
+    * Communication does not begin until the next call to {@link #status()}.
+    * <p>
+    * Same as {@link #addProxy(InetAddress, int, boolean) addProxy(address, port, false}.
+    * </p>
+    * 
+    * @param address InetAddress on which the proxy listens for MCMP requests
+    * @param port  the port on which the proxy listens for MCMP requests
+    */
    void addProxy(InetAddress address, int port);
+   
+   /**
+    * Add a proxy to the list of those with which this handler communicates.
+    * Communication does not begin until the next call to {@link #status()}.
+    * 
+    * @param address InetAddress on which the proxy listens for MCMP requests
+    * @param port  the port on which the proxy listens for MCMP requests
+    * @param established <code>true</code> if the proxy should be considered 
+    *                    {@link MCMPServer#isEstablished() established},
+    *                    <code>false</code> otherwise.
+    */
+   void addProxy(InetAddress address, int port, boolean established);
+   
+   /**
+    * Remove a proxy from the list of those with which this handler communicates.
+    * Communication does not end until the next call to {@link #status()}.
+    * 
+    * @param host the hostname of the proxy; a string suitable for passing to 
+    *             <code>InetAddress.getByHost(...)</code> 
+    * @param port the port on which the proxy listens for MCMP requests
+    */
    void removeProxy(String host, int port);
+   
+   /**
+    * Remove a proxy from the list of those with which this handler communicates.
+    * Communication does not begin until the next call to {@link #status()}.
+    * 
+    * @param address InetAddress on which the proxy listens for MCMP requests
+    * @param port  the port on which the proxy listens for MCMP requests
+    */
    void removeProxy(InetAddress address, int port);
-   void establishProxy(MCMPServer server);
+   
+   /**
+    * Get the state of all proxies
+    * 
+    * @return a set of status objects indicating the status of this handler's
+    *         communication with all proxies.
+    */
    Set<MCMPServerState> getProxyStates();
+   
+   /**
+    * Reset any proxies whose status is {@link MCMPServerState#DOWN DOWN} up to 
+    * {@link MCMPServerState#ERROR ERROR}, where the configuration will
+    * be refreshed.
+    */
    void reset();
+   
+   /** 
+    * FIXME. This is the same as markProxiesInError().
+    * 
+    * Reset any proxies whose status is {@link MCMPServerState#OK OK} down to 
+    * {@link MCMPServerState#ERROR ERROR}, which will trigger a refresh of 
+    * their configuration. To be used through JMX or similar.
+    */
    void refresh();
+   
+   /** 
+    * Reset any proxies whose status is {@link MCMPServerState#OK OK} down to 
+    * {@link MCMPServerState#ERROR ERROR}, which will trigger a refresh of 
+    * their configuration.
+    * 
+    * FIXME. This is the same as refresh().
+    */
    void markProxiesInError();   
+   
+   /**
+    * Convenience method that checks whether the status of all proxies is
+    * {@link MCMPServerState#OK OK}.
+    * 
+    * @return <code>true</code> if all proxies are {@link MCMPServerState#OK OK},
+    *         <code>false</code> otherwise
+    */
    boolean isProxyHealthOK();
    
+   /**
+    * Attempts to determine the address via which this node communicates
+    * with the proxies.
+    * 
+    * @return the address, or <code>null</code> if it cannot be determined
+    * 
+    * @throws IOException
+    */
    InetAddress getLocalAddress() throws IOException;
+   
+   /**
+    * Sends a {@link MCMPRequestType#DUMP DUMP} request to all proxies,
+    * concatentating their responses into a single string.
+    * 
+    * TODO wouldn't a List<String> be better? Let the caller concatenate if
+    * so desired.
+    * 
+    * @return the configuration information from all the accessible proxies.
+    */
    String getProxyConfiguration();
    
+   /**
+    * Perform periodic processing. Update the list of proxies to reflect any
+    * calls to <code>addProxy(...)</code> or <code>removeProxy(...)</code>.
+    * Attempt to establish communication with any proxies whose state is
+    * {@link MCMPServerState#ERROR ERROR}. If successful and a 
+    * {@link ResetRequestSource} has been provided, update the proxy with the 
+    * list of requests provided by the source.
+    */
    void status();
    
 }




More information about the jboss-cvs-commits mailing list