FileDocCategorySizeDatePackage
ThreadLocalStack.javaAPI DocJBoss 4.2.12075Fri Jul 13 20:53:58 BST 2007org.jboss.ejb3

ThreadLocalStack

public class ThreadLocalStack extends Object
Comment
author
Bill Burke
version
$Revision: 60233 $

Fields Summary
private ThreadLocal
stack
Constructors Summary
Methods Summary
public Tget()

      ArrayList<T> list = (ArrayList<T>)stack.get();
      if (list == null)
      {
         return null;
      }
      return list.get(list.size() - 1);
   
public java.util.ListgetList()

      return stack.get();     
   
public Tpop()

      ArrayList<T> list = stack.get();
      if (list == null)
      {
         return null;
      }
      T rtn = list.remove(list.size() - 1);
      if (list.size() == 0)
      {
         stack.set(null);
         list.clear();
      }
      return rtn;
   
public voidpush(T obj)


      
   
      ArrayList<T> list = stack.get();
      if (list == null)
      {
         list = new ArrayList<T>(1);
         stack.set(list);
      }
      list.add(obj);