本文整理汇总了Java中org.jgroups.blocks.RpcDispatcher类的典型用法代码示例。如果您正苦于以下问题:Java RpcDispatcher类的具体用法?Java RpcDispatcher怎么用?Java RpcDispatcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RpcDispatcher类属于org.jgroups.blocks包,在下文中一共展示了RpcDispatcher类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: start
import org.jgroups.blocks.RpcDispatcher; //导入依赖的package包/类
public void start() throws Exception {
int c;
RspList rsps;
channel=new JChannel(); // default props
disp=new RpcDispatcher(channel, null, this, this);
channel.connect("rpc-test");
while(true) {
System.out.println("[x]: exit [s]: send sync group RPC");
System.out.flush();
c=System.in.read();
switch(c) {
case 'x':
channel.close();
disp.stop();
return;
case 's':
rsps=sendGroupRpc();
System.out.println("responses:\n" + rsps);
break;
}
System.in.skip(System.in.available());
}
}
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:27,代码来源:RpcDispatcherBlocking.java
示例2: 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));
}
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:27,代码来源:Deadlock2Test.java
示例3: testTwoChannels
import org.jgroups.blocks.RpcDispatcher; //导入依赖的package包/类
/**
* Tests the deadlock resolution using two different channels. The deadlock detection
* is turned on. It implements the following scenario:
*
* Channel1 Channel2
* | |
* + -------------------------------> outerMethod()
* | RPC
* | |
* | |
* | |
* | <-- innerMethod() <-----------------+ ---------+
* | | |
* | | <-- innerMethod()
*
* If there is a deadlock, JUnit will timeout and fail the test.
*
*/
public void testTwoChannels() throws Throwable {
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);
Address localAddress2 = 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 " + localAddress2);
Object retval = disp1.callRemoteMethod(localAddress2, call, new RequestOptions(ResponseMode.GET_ALL, 0));
log("results of outerMethod(): " + retval);
}
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:41,代码来源:Deadlock2Test.java
示例4: 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());
}
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:27,代码来源:Deadlock2Test.java
示例5: setUp
import org.jgroups.blocks.RpcDispatcher; //导入依赖的package包/类
@BeforeMethod
protected void setUp() throws Exception {
a = createNode(LON, "A");
b = createNode(LON, "B");
al=new MyReceiver("A");
bl=new MyReceiver("B");
rpca = new RpcDispatcher(a, al, al, new ServerObject(a, 1));
rpcb = new RpcDispatcher(b, bl, bl, new ServerObject(b, 1));
x = createNode(SFO, "X");
y = createNode(SFO, "Y");
xl=new MyReceiver("X");
yl=new MyReceiver("Y");
rpcx = new RpcDispatcher(x, xl, xl, new ServerObject(x, 1));
rpcy = new RpcDispatcher(y, yl, yl, new ServerObject(y, 1));
}
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:17,代码来源:Relay2RpcDispatcherTest.java
示例6: startup
import org.jgroups.blocks.RpcDispatcher; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public void startup() throws Throwable
{
disp = new RpcDispatcher(channel, null, this, this);
disp.setMethodLookup(new MethodLookup()
{
@Override
public Method findMethod(short key)
{
return methods.get(key);
}
});
if (clusterName == null)
clusterName = "jca";
channel.connect(clusterName);
}
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:23,代码来源:JGroupsTransport.java
示例7: 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);
}
}
开发者ID:Jenner4S,项目名称:unitimes,代码行数:12,代码来源:SolverServerService.java
示例8: 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);
}
}
开发者ID:Jenner4S,项目名称:unitimes,代码行数:12,代码来源:SolverServerService.java
示例9: OnlineStudentSchedulingGenericUpdater
import org.jgroups.blocks.RpcDispatcher; //导入依赖的package包/类
public OnlineStudentSchedulingGenericUpdater(RpcDispatcher dispatcher, OnlineStudentSchedulingContainerRemote container) {
super();
iDispatcher = dispatcher;
iContainer = container;
setDaemon(true);
setName("Updater[generic]");
iSleepTimeInSeconds = ApplicationProperty.OnlineSchedulingQueueLoadInterval.intValue();
iLog = Logger.getLogger(OnlineStudentSchedulingGenericUpdater.class + ".updater[generic]");
}
开发者ID:Jenner4S,项目名称:unitimes,代码行数:10,代码来源:OnlineStudentSchedulingGenericUpdater.java
示例10: QuoteClient
import org.jgroups.blocks.RpcDispatcher; //导入依赖的package包/类
public QuoteClient() {
super();
try {
channel=new JChannel(props);
channel.setDiscardOwnMessages(true);
disp=new RpcDispatcher(channel, null, this, this);
channel.connect(channel_name);
}
catch(Exception e) {
System.err.println("QuoteClient(): " + e);
}
addWindowListener(this);
}
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:14,代码来源:QuoteClient.java
示例11: start
import org.jgroups.blocks.RpcDispatcher; //导入依赖的package包/类
public void start() {
try {
channel=new JChannel(props);
disp=new RpcDispatcher(channel, this, this, this);
channel.connect(channel_name);
System.out.println("\nQuote Server started at " + new Date());
System.out.println("Joined channel '" + channel_name + "' (" + channel.getView().size() + " members)");
channel.getState(null, 0);
System.out.println("Ready to serve requests");
}
catch(Exception e) {
log.error("QuoteServer.start() : " + e);
System.exit(-1);
}
}
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:16,代码来源:QuoteServer.java
示例12: setup
import org.jgroups.blocks.RpcDispatcher; //导入依赖的package包/类
@BeforeMethod
protected void setup() throws Exception {
a=create("A");
b=create("B");
da=new RpcDispatcher(a, this);
db=new RpcDispatcher(b, this);
a.connect("FlowControlUnitTest");
b.connect("FlowControlUnitTest");
}
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:10,代码来源:FlowControlUnitTest.java
示例13: CacheManager
import org.jgroups.blocks.RpcDispatcher; //导入依赖的package包/类
public CacheManager(Vertx vertx, JChannel channel) {
this.channel = channel;
this.multiMapService = new DefaultRpcMultiMapService();
this.mapService = new DefaultRpcMapService();
RpcServerObjDelegate server_obj = new RpcServerObjDelegate(mapService, multiMapService);
// Don't want to loose the channel receiver.
this.dispatcher = new RpcDispatcher(this.channel, this, channel.getReceiver(), server_obj);
this.dispatcher.setMethodLookup(server_obj.getMethodLookup());
this.executorService = new DefaultRpcExecutorService(vertx, dispatcher);
}
开发者ID:vert-x3,项目名称:vertx-jgroups,代码行数:14,代码来源:CacheManager.java
示例14: 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);
}
}
}
开发者ID:kenweezy,项目名称:teiid,代码行数:14,代码来源:JGroupsOutputStream.java
示例15: getDispatcher
import org.jgroups.blocks.RpcDispatcher; //导入依赖的package包/类
private RpcDispatcher getDispatcher() {
if (iServer instanceof SolverServerImplementation)
return ((SolverServerImplementation)iServer).getDispatcher();
return null;
}
开发者ID:Jenner4S,项目名称:unitimes,代码行数:6,代码来源:SolverServerService.java
示例16: getDispatcher
import org.jgroups.blocks.RpcDispatcher; //导入依赖的package包/类
@Override
public RpcDispatcher getDispatcher() { return iDispatcher; }
开发者ID:Jenner4S,项目名称:unitimes,代码行数:3,代码来源:InstructorSchedulingContainerRemote.java
示例17: SolverContainerWrapper
import org.jgroups.blocks.RpcDispatcher; //导入依赖的package包/类
public SolverContainerWrapper(RpcDispatcher dispatcher, RemoteSolverContainer<T> container, boolean checkLocal) {
iDispatcher = dispatcher;
iContainer = container;
iCheckLocal = checkLocal;
}
开发者ID:Jenner4S,项目名称:unitimes,代码行数:6,代码来源:SolverContainerWrapper.java
示例18: getDispatcher
import org.jgroups.blocks.RpcDispatcher; //导入依赖的package包/类
@Override
public RpcDispatcher getDispatcher() {
return iDispatcher;
}
开发者ID:Jenner4S,项目名称:unitimes,代码行数:5,代码来源:DummySolverServer.java
示例19: getDispatcher
import org.jgroups.blocks.RpcDispatcher; //导入依赖的package包/类
public RpcDispatcher getDispatcher() {
return iDispatcher;
}
开发者ID:Jenner4S,项目名称:unitimes,代码行数:4,代码来源:RemoteRoomAvailability.java
示例20: initialize
import org.jgroups.blocks.RpcDispatcher; //导入依赖的package包/类
@Override
public void initialize(JChannel channel, String localHostname) throws Exception {
this.rpcDispatcher = new RpcDispatcher(channel, this);
}
开发者ID:ccremer,项目名称:clustercode,代码行数:5,代码来源:JGroupsMessageDispatcherImpl.java
注:本文中的org.jgroups.blocks.RpcDispatcher类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论