mx4j/src/core/mx4j/remote ConnectionResolver.java,1.2,1.3

Simone Bordet <[email protected]>
Newsgroups gmane.comp.java.mx4j.cvs
Message-ID <[email protected]>
Update of /cvsroot/mx4j/mx4j/src/core/mx4j/remote
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24441a/src/core/mx4j/remote

Modified Files:
	ConnectionResolver.java 
Log Message:
+ Added method destroyServer
+ Updated JavaDocs

Index: ConnectionResolver.java
===================================================================
RCS file: /cvsroot/mx4j/mx4j/src/core/mx4j/remote/ConnectionResolver.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ConnectionResolver.java	1 Mar 2004 18:13:13 -0000	1.2
--- ConnectionResolver.java	18 Jul 2004 21:02:58 -0000	1.3
***************
*** 12,26 ****
  import java.util.Map;
  import java.util.StringTokenizer;
- 
- import javax.management.remote.JMXServiceURL;
  import javax.management.remote.JMXConnectorServerFactory;
  
  import mx4j.log.Logger;
- import mx4j.remote.MX4JRemoteConstants;
- import mx4j.remote.ProviderHelper;
  
  /**
   * ConnectionResolver handles the details of creating connections for different protocols.
!  * Subclasses for the specific protocol are found using a mechanism very similar to the
   * one specified by {@link javax.management.remote.JMXConnectorFactory}. Here a subclass
   * has a fully qualified name specified like this:
--- 12,23 ----
  import java.util.Map;
  import java.util.StringTokenizer;
  import javax.management.remote.JMXConnectorServerFactory;
+ import javax.management.remote.JMXServiceURL;
  
  import mx4j.log.Logger;
  
  /**
   * ConnectionResolver handles the details of creating connections for different protocols.
!  * Subclasses for the specific protocol are instantiated using a mechanism very similar to the
   * one specified by {@link javax.management.remote.JMXConnectorFactory}. Here a subclass
   * has a fully qualified name specified like this:
***************
*** 30,33 ****
--- 27,32 ----
   * The former uses it to lookup stubs or connections to the server side; the latter uses it
   * to create server instances and make them availale to clients, for example via JNDI.
+  * The client and server methods have not been splitted into 2 different interfaces because
+  * most of the times they share common code, although it may have been a better design.
   *
   * @author <a href="mailto:[email protected]">Simone Bordet</a>
***************
*** 64,68 ****
        Object object = environment.get(loaderKey);
        if (object == null) return Thread.currentThread().getContextClassLoader();
!       if (object != null && !(object instanceof ClassLoader)) throw new IllegalArgumentException("Environment property " + loaderKey + " must be a ClassLoader");
        return (ClassLoader)object;
     }
--- 63,67 ----
        Object object = environment.get(loaderKey);
        if (object == null) return Thread.currentThread().getContextClassLoader();
!       if (!(object instanceof ClassLoader)) throw new IllegalArgumentException("Environment property " + loaderKey + " must be a ClassLoader");
        return (ClassLoader)object;
     }
***************
*** 115,125 ****
  
     /**
!     * Looks up a connection to the server side as specified in the given JMXServiceURL.
!     * This method is used by {@link javax.management.remote.JMXConnector}s.
      */
     public abstract Object lookupClient(JMXServiceURL url, Map environment) throws IOException;
  
     /**
!     * Connects the client returned by {@link #lookupClient} to the server side
      */
     public abstract Object bindClient(Object client, Map environment) throws IOException;
--- 114,128 ----
  
     /**
!     * Looks up a connection with the server side as specified in the given JMXServiceURL.
!     * This method is used in implementations of {@link javax.management.remote.JMXConnector#connect()}.
!     *
!     * @see #bindClient
      */
     public abstract Object lookupClient(JMXServiceURL url, Map environment) throws IOException;
  
     /**
!     * Connects the client returned by {@link #lookupClient} to the server side.
!     *
!     * @return An object of the same type as the client passed in; normally the client object itself
      */
     public abstract Object bindClient(Object client, Map environment) throws IOException;
***************
*** 129,139 ****
      * It is only a factory method, it should just return a fresh instance of the server;
      * other methods are responsible to make it available to clients (for example exporting it).
!     * This method is used by {@link javax.management.remote.JMXConnectorServer}s.
      * @see #bindServer
      */
     public abstract Object createServer(JMXServiceURL url, Map environment) throws IOException;
  
     /**
!     * Binds the server created by {@link #createServer} to a place specified in the JMXServiceURL.
      * @return a new JMXServiceURL that specifies where the server has been bound to.
      * @see #unbindServer
--- 132,145 ----
      * It is only a factory method, it should just return a fresh instance of the server;
      * other methods are responsible to make it available to clients (for example exporting it).
!     * This method is used in implementations of {@link javax.management.remote.JMXConnectorServer#start}.
!     *
      * @see #bindServer
+     * @see #destroyServer
      */
     public abstract Object createServer(JMXServiceURL url, Map environment) throws IOException;
  
     /**
!     * Binds the server created by {@link #createServer} to a place specified by the JMXServiceURL.
!     *
      * @return a new JMXServiceURL that specifies where the server has been bound to.
      * @see #unbindServer
***************
*** 142,148 ****
  
     /**
!     * Unbinds the server created by {@link #createServer} from the place specified in the JMXServiceURL.
!     * @see #bindServer
      */
     public abstract void unbindServer(Object server, JMXServiceURL address, Map environment) throws IOException;
  }
--- 148,163 ----
  
     /**
!     * Unbinds the server bound by {@link #bindServer} from the place specified by the JMXServiceURL.
!     *
!     * @see #destroyServer
      */
     public abstract void unbindServer(Object server, JMXServiceURL address, Map environment) throws IOException;
+ 
+    /**
+     * Destroys the server created by {@link #createServer}, by cleaning up resources it may have requested
+     * at creation time
+     *
+     * @see #createServer
+     */
+    public abstract void destroyServer(Object server, JMXServiceURL url, Map environment) throws IOException;
  }



-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.