Commits

Anonymous committed d0654a3

Fixing possible memory leaks by using internal classes in thread locals
XW-560

git-svn-id: http://svn.opensymphony.com/svn/xwork/branches/2.0@1623e221344d-f017-0410-9bd5-d282ab1896d7

  • Participants
  • Parent commits b6005a5
  • Branches 2.0, xwork_2_0_7

Comments (0)

Files changed (1)

File src/java/com/opensymphony/xwork2/inject/ContainerImpl.java

     return factoryNamesByType.get(type);
   }
 
-  ThreadLocal<InternalContext[]> localContext =
-      new ThreadLocal<InternalContext[]>() {
+  ThreadLocal<Object[]> localContext =
+      new ThreadLocal<Object[]>() {
         protected InternalContext[] initialValue() {
           return new InternalContext[1];
         }
    * necessary.
    */
   <T> T callInContext(ContextualCallable<T> callable) {
-    InternalContext[] reference = localContext.get();
+    InternalContext[] reference = (InternalContext[]) localContext.get();
     if (reference[0] == null) {
       reference[0] = new InternalContext(this);
       try {
     return constructors.get(implementation);
   }
 
-  final ThreadLocal<Scope.Strategy> localScopeStrategy =
-      new ThreadLocal<Scope.Strategy>();
+  final ThreadLocal<Object> localScopeStrategy =
+      new ThreadLocal<Object>();
 
   public void setScopeStrategy(Scope.Strategy scopeStrategy) {
     this.localScopeStrategy.set(scopeStrategy);