1 23 24 28 29 package com.sun.enterprise.admin.util.proxy; 30 31 import java.lang.reflect.Method ; 32 import java.util.Iterator ; 33 import java.util.Stack ; 34 35 38 public class CallStack { 39 40 private Stack callStack = new Stack (); 41 42 43 public CallStack() { 44 } 45 46 public int getStackSize() { 47 return callStack.size(); 48 } 49 50 public void beginCall(Method m, Object [] args) { 51 Call call = new Call(m, args); 52 beginCall(call); 53 } 54 55 public void beginCall(Call call) { 56 callStack.push(call); 57 } 58 59 public void endCall() { 60 Call call = (Call)callStack.pop(); 61 if (!call.getState().isFinished()) { 62 call.setState(CallState.SUCCESS); 63 } 64 } 65 66 public void endCallWithError(Throwable th) { 67 Call call = (Call)callStack.peek(); 68 call.setState(CallState.FAILED); 69 call.setFailureReason(th); 70 endCall(); 71 } 72 73 public Call getActiveCall() { 74 return (Call)callStack.peek(); 75 } 76 77 public Iterator getCallStack() { 78 return callStack.iterator(); 79 } 80 81 } 82 | Popular Tags |