KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > dynaop > PooledInvocation


1 package dynaop;
2
3 /**
4  *
5  *
6  * @author Bob Lee (crazybob@crazybob.org)
7  */

8 class PooledInvocation extends InvocationImpl {
9
10     static PooledInvocation head;
11     
12     PooledInvocation next;
13     
14     void release() {
15         clear();
16         synchronized (PooledInvocation.class) {
17             this.next = head;
18             head = this;
19         }
20     }
21
22     void clear() {
23         setMethod(null);
24         setArguments(null);
25         setTarget(null);
26         clearInterceptors();
27         setProxy(null);
28     }
29     
30     static synchronized PooledInvocation getInstance() {
31         if (head == null)
32             return new PooledInvocation();
33         PooledInvocation instance = head;
34         head = head.next;
35         return instance;
36     }
37 }
38
Popular Tags