[jboss-cvs] JBossAS SVN: r88765 - projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/server.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue May 12 15:39:19 EDT 2009


Author: ALRubinger
Date: 2009-05-12 15:39:19 -0400 (Tue, 12 May 2009)
New Revision: 88765

Modified:
   projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/server/JBossASServerImpl.java
Log:
[JBBOOT-73] Do not leak mutable state of server startDate

Modified: projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/server/JBossASServerImpl.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/server/JBossASServerImpl.java	2009-05-12 17:42:26 UTC (rev 88764)
+++ projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/server/JBossASServerImpl.java	2009-05-12 19:39:19 UTC (rev 88765)
@@ -93,8 +93,10 @@
    private final Version version = Version.getInstance();
 
    /**
-    * The date in which the server was started.  Synchronized on "this", 
-    * volatile as it's exported and we don't want to block on it.
+    * The date in which the server was started.  
+    * Must not be exported (as it's mutable).  Synchronized
+    * on "this" (as implicit from start() lifecycle) and volatile
+    * so that we don't need to block in {@link JBossASServerImpl#getStartDate()}
     */
    private volatile Date startDate;
 
@@ -217,7 +219,9 @@
    @ManagementProperty(description = "The server start time")
    public Date getStartDate()
    {
-      return startDate;
+      // We copy so we don't export the mutable state, JBBOOT-73
+      final Date copyDate = (Date) startDate.clone();
+      return copyDate;
    }
 
    /* (non-Javadoc)




More information about the jboss-cvs-commits mailing list