KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > cache > RPCManager


1 /*
2  * JBoss, Home of Professional Open Source
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.cache;
8
9 import org.jboss.cache.marshall.MethodCall;
10 import org.jgroups.Address;
11
12 import java.lang.reflect.Method JavaDoc;
13 import java.util.List JavaDoc;
14
15 /**
16  * Manager that handles all RPC calls between JBoss Cache instances
17  *
18  * @author <a HREF="mailto:manik@jboss.org">Manik Surtani (manik@jboss.org)</a>
19  */

20 public class RPCManager
21 {
22    CacheImpl c;
23
24    private RPCManager(CacheImpl c)
25    {
26       this.c = c;
27    }
28
29    public static RPCManager getInstance(CacheImpl c)
30    {
31       RPCManager rpcManager = c.getRpcManager();
32       if (rpcManager == null)
33       {
34          rpcManager = new RPCManager(c);
35          c.setRpcManager(rpcManager);
36       }
37
38       return rpcManager;
39    }
40
41    // for now, we delegate RPC calls to deprecated methods in CacheImpl.
42

43    public List JavaDoc callRemoteMethods(List JavaDoc<Address> recipients, MethodCall methodCall, int mode, boolean excludeSelf, long timeout) throws Exception JavaDoc
44    {
45       return c.callRemoteMethods(recipients, methodCall, mode, excludeSelf, timeout);
46    }
47
48    public boolean isCoordinator()
49    {
50       return c.isCoordinator();
51    }
52
53    public Address getCoordinator()
54    {
55       return c.getCoordinator();
56    }
57
58    public List JavaDoc callRemoteMethods(List JavaDoc<Address> recipients, MethodCall methodCall, boolean synchronous, boolean excludeSelf, int timeout) throws Exception JavaDoc
59    {
60       return c.callRemoteMethods(recipients, methodCall, synchronous, excludeSelf, timeout);
61    }
62
63    public List JavaDoc callRemoteMethods(List JavaDoc<Address> recipients, Method JavaDoc method, Object JavaDoc[] arguments, boolean synchronous, boolean excludeSelf, long timeout) throws Exception JavaDoc
64    {
65       return c.callRemoteMethods(recipients, method, arguments, synchronous, excludeSelf, timeout);
66    }
67
68    /**
69     * @return Returns the replication queue (if one is used), null otherwise.
70     */

71    public ReplicationQueue getReplicationQueue()
72    {
73       return c.getReplQueue();
74    }
75 }
76
Popular Tags