当前位置: 首页>>代码示例>>Java>>正文


Java Message.getObject方法代码示例

本文整理汇总了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;
    }
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:19,代码来源:FlowControl.java

示例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;
    }
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:19,代码来源:FC.java

示例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);
        } 
    }
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:25,代码来源:PCServiceEntityProvider.java

示例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();
  }
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:18,代码来源:ClusterClientTest.java

示例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);
    }
}
 
开发者ID:cerner,项目名称:jwala,代码行数:13,代码来源:JvmStateReceiverAdapter.java

示例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;
	}
}
 
开发者ID:e-Contract,项目名称:eid-applet,代码行数:11,代码来源:JGroupsSpikeTest.java

示例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);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:28,代码来源:DISCARD_PAYLOAD.java

示例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);
    }
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:8,代码来源:MyReceiver.java

示例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);
        }
    }
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:9,代码来源:SequencerOrderTest.java

示例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);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:9,代码来源:MessageTest.java

示例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;
        }
    }
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:14,代码来源:MessageBeforeConnectedTest.java

示例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);
    }
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:8,代码来源:SimpleChat.java

示例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;
        }
    }
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:35,代码来源:ChatManagerImpl.java

示例14: receive

import org.jgroups.Message; //导入方法依赖的package包/类
public void receive(Message msg) {
    String line="[" + msg.getSrc() + "]: " + msg.getObject();
    System.out.println(line);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:5,代码来源:Chat.java

示例15: receive

import org.jgroups.Message; //导入方法依赖的package包/类
public void receive(Message msg) {
    if(msg != null) {
        Long num=(Long)msg.getObject();
        seqnos.add(num);
    }
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:7,代码来源:NAKACK_Test.java


注:本文中的org.jgroups.Message.getObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。