You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ka...@apache.org on 2007/07/01 17:11:32 UTC

svn commit: r552323 - /db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/context/ContextManager.java

Author: kahatlen
Date: Sun Jul  1 08:11:31 2007
New Revision: 552323

URL: http://svn.apache.org/viewvc?view=rev&rev=552323
Log:
DERBY-2884: CtxStack should only create unmodifiable view once per instance

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/context/ContextManager.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/context/ContextManager.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/context/ContextManager.java?view=diff&rev=552323&r1=552322&r2=552323
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/context/ContextManager.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/context/ContextManager.java Sun Jul  1 08:11:31 2007
@@ -65,7 +65,10 @@
 	 * synchronized).
 	 */
 	private static final class CtxStack {
-		private ArrayList stack_ = new ArrayList();
+		/** Internal list with all the elements of the stack. */
+		private final ArrayList stack_ = new ArrayList();
+		/** Read-only view of the internal list. */
+		private final List view_ = Collections.unmodifiableList(stack_);
 
 		// Keeping a reference to the top element on the stack
 		// optimizes the frequent accesses to this element. The
@@ -94,7 +97,7 @@
 		}
 		boolean isEmpty() { return stack_.isEmpty(); }
 		List getUnmodifiableList() { 
-		    return Collections.unmodifiableList(stack_); 
+			return view_;
 		}
 	}