jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r409543 - /jackrabbit/branches/1.0/jcr-server/webapp/src/java/org/apache/jackrabbit/j2ee/RepositoryStartupServlet.java
Date Fri, 26 May 2006 02:36:55 GMT
Author: jukka
Date: Thu May 25 19:36:55 2006
New Revision: 409543

URL: http://svn.apache.org/viewvc?rev=409543&view=rev
Log:
1.0: Merged revision 393456: JCR-396

Modified:
    jackrabbit/branches/1.0/jcr-server/webapp/src/java/org/apache/jackrabbit/j2ee/RepositoryStartupServlet.java

Modified: jackrabbit/branches/1.0/jcr-server/webapp/src/java/org/apache/jackrabbit/j2ee/RepositoryStartupServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.0/jcr-server/webapp/src/java/org/apache/jackrabbit/j2ee/RepositoryStartupServlet.java?rev=409543&r1=409542&r2=409543&view=diff
==============================================================================
--- jackrabbit/branches/1.0/jcr-server/webapp/src/java/org/apache/jackrabbit/j2ee/RepositoryStartupServlet.java
(original)
+++ jackrabbit/branches/1.0/jcr-server/webapp/src/java/org/apache/jackrabbit/j2ee/RepositoryStartupServlet.java
Thu May 25 19:36:55 2006
@@ -167,6 +167,19 @@
     private String rmiURI;
 
     /**
+     * Keeps a strong reference to the server side RMI repository instance to
+     * prevent the RMI distributed Garbage Collector from collecting the
+     * instance making the repository unaccessible though it should still be.
+     * This field is only set to a non-<code>null</code> value, if registration
+     * of the repository to an RMI registry succeeded in the
+     * {@link #registerRMI()} method.
+     *
+     * @see #registerRMI()
+     * @see #unregisterRMI()
+     */
+    private Remote rmiRepository;
+
+    /**
      * Initializes the servlet
      * @throws ServletException
      */
@@ -471,7 +484,10 @@
                 log.debug("Registering repository as " + rmiName
                     + " to registry " + reg);
                 reg.bind(rmiName, remote);
+
+                // when successfull, keep references
                 this.rmiURI = rmiURI;
+                this.rmiRepository = remote;
                 log.info("Repository bound via RMI with name: " + rmiURI);
             } else {
                 log.info("RMI registry missing, cannot bind repository via RMI");
@@ -526,6 +542,10 @@
      * been registered.
      */
     private void unregisterRMI() {
+        // drop strong referenece to remote repository
+        rmiRepository = null;
+
+        // unregister repository
         if (rmiURI != null) {
             try {
                 Naming.unbind(rmiURI);
@@ -560,4 +580,4 @@
             throws RemoteException {
         return new ServerAdapterFactory().getRemoteRepository(repository);
     }
-}
\ No newline at end of file
+}



Mime
View raw message