本文整理汇总了Java中org.jgroups.Message.getObject方法的典型用法代码示例。如果您正苦于以下问题:Java Message.getObject方法的具体用法?Java Message.getObject怎么用?Java Message.getObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jgroups.Message
的用法示例。
在下文中一共展示了Message.getObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleUpEvent
import org.jgroups.Message; //导入方法依赖的package包/类
protected void handleUpEvent(final Message msg, FcHeader hdr) {
switch(hdr.type) {
case FcHeader.REPLENISH:
num_credit_responses_received++;
handleCredit(msg.getSrc(), (Long)msg.getObject());
break;
case FcHeader.CREDIT_REQUEST:
num_credit_requests_received++;
Address sender=msg.getSrc();
Long requested_credits=(Long)msg.getObject();
if(requested_credits != null)
handleCreditRequest(received, sender,requested_credits);
break;
default:
log.error("header type " + hdr.type + " not known");
break;
}
}
示例2: handleUpEvent
import org.jgroups.Message; //导入方法依赖的package包/类
protected void handleUpEvent(FcHeader hdr, Message msg) {
switch(hdr.type) {
case FcHeader.REPLENISH:
num_credit_responses_received++;
handleCredit(msg.getSrc(), (Number)msg.getObject());
break;
case FcHeader.CREDIT_REQUEST:
num_credit_requests_received++;
Address sender=msg.getSrc();
Long sent_credits=(Long)msg.getObject();
if(sent_credits != null)
handleCreditRequest(received, sender,sent_credits);
break;
default:
log.error("header type " + hdr.type + " not known");
break;
}
}
示例3: receive
import org.jgroups.Message; //导入方法依赖的package包/类
/**
* JGroups message listener.
*/
public void receive(Message msg) {
Object o = msg.getObject();
if (o instanceof UserMessage) {
UserMessage message = (UserMessage) o;
if (message.to == null) {
if (message.clear) {
String userId = message.from;
synchronized (messageMap) {
messageMap.remove(userId);
}
} else {
log.debug("Received heartbeat from cluster ...");
heartbeatMap.put(message.from, message);
}
} else {
log.debug("Received {} message from cluster ...", message.video ? "video" : "");
addMessageToMap(message);
}
}
}
示例4: receive
import org.jgroups.Message; //导入方法依赖的package包/类
@Override
public void receive(Message msg) {
try {
MasterTest mt = (MasterTest)msg.getObject();
testsRun++;
System.out.println("Received test: " + mt.testname);
ClientTest ct = (ClientTest)tests.get(mt.testname);
if (ct == null) throw new OntopiaRuntimeException("Could not find test: " + mt.testname);
ct.run(mt);
topicmap.getStore().commit();
} catch (Exception e) {
testsFailed++;
e.printStackTrace();
}
}
示例5: receive
import org.jgroups.Message; //导入方法依赖的package包/类
@Override
public void receive(final Message jGroupMsg) {
final Map serverInfoMap = (Map) jGroupMsg.getObject();
final Jvm jvm = getJvm(serverInfoMap);
final JvmState jvmState = getJvmState(serverInfoMap);
if (jvm != null && !JvmState.JVM_STOPPED.equals(jvmState)) {
jvmStateService.updateState(jvm, jvmState, StringUtils.EMPTY);
} else if (jvm == null) {
LOGGER.error("Cannot update the state since no JVM was found with the following details: {}", serverInfoMap);
}
}
示例6: receive
import org.jgroups.Message; //导入方法依赖的package包/类
@Override
public void receive(Message msg) {
Address srcAddress = msg.getSrc();
Object object = msg.getObject();
LOG.debug("receiving from " + srcAddress + " message " + object);
LOG.debug("message object type: " + object.getClass().getName());
if (this.expectedMessage.equals(object)) {
this.expectedMessageReceived = true;
}
}
示例7: down
import org.jgroups.Message; //导入方法依赖的package包/类
public Object down(Event evt) {
if(evt.getType() == Event.MSG) {
Message msg=(Message)evt.getArg();
if(msg.getLength() > 0) {
try {
Long payload=(Long)msg.getObject();
if(payload != null) {
if(payload == seqno) {
synchronized(this) {
if(num_discards < 3) {
num_discards++;
return null;
}
}
}
if(payload == duplicate) { // inject a duplicate message
super.down(evt); // pass it down, will passed down a second time by the default down_prot.down(evt)
}
}
}
catch(Throwable t) {
;
}
}
}
return down_prot.down(evt);
}
示例8: receive
import org.jgroups.Message; //导入方法依赖的package包/类
public void receive(Message msg) {
T obj=(T)msg.getObject();
list.add(obj);
if(verbose) {
System.out.println((name() != null? name() + ":" : "") + " received message from " + msg.getSrc() + ": " + obj);
}
}
示例9: receive
import org.jgroups.Message; //导入方法依赖的package包/类
public void receive(Message msg) {
String val=(String)msg.getObject();
if(val != null) {
synchronized(msgs) {
msgs.add(val);
}
}
}
示例10: testSetObject
import org.jgroups.Message; //导入方法依赖的package包/类
public static void testSetObject() {
String s1="Bela Ban";
Message m1=new Message(null, null, s1);
Assert.assertEquals(0, m1.getOffset());
Assert.assertEquals(m1.getBuffer().length, m1.getLength());
String s2=(String)m1.getObject();
Assert.assertEquals(s2, s1);
}
示例11: receive
import org.jgroups.Message; //导入方法依赖的package包/类
protected void receive(Message msg) {
String greeting=(String)msg.getObject();
msgs.add(greeting);
System.out.println("received " + greeting + " from " + msg.getSrc());
if(HELLO1.equals(greeting)) {
try {
a.send(new Message(a.getAddress(), HELLO2));
}
catch(Exception e) {
ex=e;
}
}
}
示例12: receive
import org.jgroups.Message; //导入方法依赖的package包/类
public void receive(Message msg) {
String line=msg.getSrc() + ": " + msg.getObject();
System.out.println(line);
synchronized(state) {
state.add(line);
}
}
示例13: receive
import org.jgroups.Message; //导入方法依赖的package包/类
/**
* JGroups message listener.
*/
public void receive(Message msg) {
Object o = msg.getObject();
if (o instanceof TransferableChatMessage) {
TransferableChatMessage message = (TransferableChatMessage) o;
String id = message.getId();
String channelId = message.getChannelId();
switch(message.getType()){
case CHAT :
log.debug("Received message {} from cluster ...", id);
addMessageToMap(message);
break;
case HEARTBEAT :
log.debug("Received heartbeat {} - {} from cluster ...", id, channelId);
addHeartBeat(channelId, id);
break;
case CLEAR :
log.debug("Received clear message {} from cluster ...", id);
//as guava cache is synchronized, maybe this is not necessary
synchronized (messageMap){
messageMap.invalidate(id);
}
break;
case REMOVE :
log.debug("Received remove message {} from cluster ...", id);
addMessageToMap(message);
break;
}
}
}
示例14: receive
import org.jgroups.Message; //导入方法依赖的package包/类
public void receive(Message msg) {
String line="[" + msg.getSrc() + "]: " + msg.getObject();
System.out.println(line);
}
示例15: receive
import org.jgroups.Message; //导入方法依赖的package包/类
public void receive(Message msg) {
if(msg != null) {
Long num=(Long)msg.getObject();
seqnos.add(num);
}
}