本文整理汇总了Java中org.jgroups.blocks.RpcDispatcher.callRemoteMethods方法的典型用法代码示例。如果您正苦于以下问题:Java RpcDispatcher.callRemoteMethods方法的具体用法?Java RpcDispatcher.callRemoteMethods怎么用?Java RpcDispatcher.callRemoteMethods使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jgroups.blocks.RpcDispatcher
的用法示例。
在下文中一共展示了RpcDispatcher.callRemoteMethods方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testOneChannel
import org.jgroups.blocks.RpcDispatcher; //导入方法依赖的package包/类
/**
* Tests the deadlock resolution using self-calls on a single channel. The deadlock detection
* is turned on so the method call should go straight through. If there is a problem, JUnit will
* timeout.
*
* @throws Exception
*/
public void testOneChannel() throws Exception {
c1 = createChannel(true);
ServerObject serverObject = new ServerObject("obj1");
RpcDispatcher disp=new RpcDispatcher(c1, serverObject);
serverObject.setRpcDispatcher(disp);
c1.connect(name);
Address localAddress = c1.getAddress();
// call the nested group method on itself
MethodCall call = new MethodCall("outerMethod", new Object[0], new Class[0]);
log("calling outerMethod() on all members");
RspList rspList = disp.callRemoteMethods(null, call, new RequestOptions(ResponseMode.GET_ALL, 0));
log("results of outerMethod(): " + rspList);
Assert.assertEquals(1, rspList.size());
assertEquals("outerMethod[innerMethod]", rspList.getValue(localAddress));
assertTrue(rspList.isReceived(localAddress));
assertFalse(rspList.isSuspected(localAddress));
}
示例2: testTwoChannelsWithInitialMulticast
import org.jgroups.blocks.RpcDispatcher; //导入方法依赖的package包/类
public void testTwoChannelsWithInitialMulticast() throws Exception {
ServerObject obj1, obj2 = null;
c1 = createChannel(true);
obj1 = new ServerObject("obj1");
RpcDispatcher disp1=new RpcDispatcher(c1, obj1);
obj1.setRpcDispatcher(disp1);
c1.connect(name);
c2 = createChannel(c1);
obj2 = new ServerObject("obj2");
RpcDispatcher disp2=new RpcDispatcher(c2, obj2);
obj2.setRpcDispatcher(disp2);
c2.connect(name);
Vector<Address> dests=new Vector<>();
dests.add(c1.getAddress());
dests.add(c2.getAddress());
// call a point-to-point method on Member 2 that triggers a nested distributed RPC
MethodCall call = new MethodCall("outerMethod", new Object[0], new Class[0]);
log("calling outerMethod() on all members");
RspList rsps = disp1.callRemoteMethods(dests, call, new RequestOptions(ResponseMode.GET_ALL, 0));
log("results of outerMethod():\n" + rsps);
Assert.assertEquals(2, rsps.size());
}
示例3: setApplicationProperty
import org.jgroups.blocks.RpcDispatcher; //导入方法依赖的package包/类
public void setApplicationProperty(Long sessionId, String key, String value) {
try {
RpcDispatcher dispatcher = getDispatcher();
if (dispatcher != null)
dispatcher.callRemoteMethods(null, "setApplicationProperty", new Object[] { sessionId, key, value }, new Class[] { Long.class, String.class, String.class }, SolverServerImplementation.sAllResponses);
else
iServer.setApplicationProperty(sessionId, key, value);
} catch (Exception e) {
sLog.error("Failed to update the application property " + key + " along the cluster: " + e.getMessage(), e);
}
}
示例4: setLoggingLevel
import org.jgroups.blocks.RpcDispatcher; //导入方法依赖的package包/类
public void setLoggingLevel(String name, Integer level) {
try {
RpcDispatcher dispatcher = getDispatcher();
if (dispatcher != null)
dispatcher.callRemoteMethods(null, "setLoggingLevel", new Object[] { name, level }, new Class[] { String.class, Integer.class }, SolverServerImplementation.sAllResponses);
else
iServer.setLoggingLevel(name, level);
} catch (Exception e) {
sLog.error("Failed to update the logging level for " + name + " along the cluster: " + e.getMessage(), e);
}
}
示例5: JGroupsOutputStream
import org.jgroups.blocks.RpcDispatcher; //导入方法依赖的package包/类
public JGroupsOutputStream(RpcDispatcher disp, List<Address> dests, Serializable stateId, short methodOffset, boolean sendCreate) throws IOException {
this.disp=disp;
this.dests=dests;
this.stateId=stateId;
this.methodOffset = methodOffset;
if (sendCreate) {
try {
disp.callRemoteMethods(this.dests, new MethodCall(methodOffset, new Object[] {stateId}), new RequestOptions(ResponseMode.GET_NONE, 0).setAnycasting(dests != null));
} catch(Exception e) {
throw new IOException(e);
}
}
}