本文整理了Java中org.jgroups.Message.getBuffer()
方法的一些代码示例,展示了Message.getBuffer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getBuffer()
方法的具体详情如下:
包路径:org.jgroups.Message
类名称:Message
方法名:getBuffer
[英]Returns a copy of the buffer if offset and length are used, otherwise a reference.
[中]如果使用了偏移量和长度,则返回缓冲区的副本,否则返回引用。
代码示例来源:origin: wildfly/wildfly
public byte[] buffer() {return getBuffer();}
public Buffer buffer2() {return getBuffer2();}
代码示例来源:origin: wildfly/wildfly
@Override
public void receive(org.jgroups.Message msg) {
if (logger.isTraceEnabled())
logger.trace("sending message " + msg);
dequeue.add(msg.getBuffer());
}
代码示例来源:origin: orbit/orbit
private void doReceive(final Message msg)
{
final NodeInfo nodeInfo = nodeMap.get(msg.getSrc());
if (nodeInfo == null)
{
logger.warn("Received message from invalid address {}", msg.getSrc());
messageListener.receive(new NodeAddressImpl(new java.util.UUID(((UUID) msg.getSrc()).getMostSignificantBits(), ((UUID) msg.getSrc()).getLeastSignificantBits())), msg.getBuffer());
}
else
{
messageListener.receive(nodeInfo.nodeAddress, msg.getBuffer());
}
}
代码示例来源:origin: apache/geode
@Override
public void receive(Message msg) {
byte[] msgBytes = msg.getBuffer();
if (pingPonger.isPingMessage(msgBytes)) {
try {
pingPonger.sendPongMessage(channel, myAddress, msg.getSrc());
} catch (Exception e) {
logger.debug("Failed sending Pong message to " + msg.getSrc());
}
} else if (pingPonger.isPongMessage(msgBytes)) {
pongReceived(msg.getSrc());
}
}
代码示例来源:origin: apache/geode
private void filter(Message msg, int direction) {
if (direction == INCOMING) {
Header h = msg.getHeader(frag2HeaderId);
boolean copyBuffer = false;
if (h != null && h instanceof FragHeader) {
copyBuffer = true;
} else {
h = msg.getHeader(unicastHeaderId);
if (h instanceof UNICAST3.Header) {
copyBuffer = true;
} else {
h = msg.getHeader(nakackHeaderId);
if (h instanceof NakAckHeader2) {
copyBuffer = true;
}
}
}
if (copyBuffer) {
// JGroups doesn't copy its message buffer when thread pools are
// disabled. This causes Frag2 fragments to become corrupted
msg.setBuffer(msg.getBuffer(), 0, msg.getLength());
}
}
}
}
代码示例来源:origin: wildfly/wildfly
protected void handleSecretKeyRequest(final Message msg) {
if(!inView(msg.src(), "key requester %s is not in current view %s; ignoring key request"))
return;
log.debug("%s: received secret key request from %s", local_addr, msg.getSrc());
try {
PublicKey tmpKey=generatePubKey(msg.getBuffer());
sendSecretKey(secret_key, tmpKey, msg.getSrc());
}
catch(Exception e) {
log.warn("%s: unable to reconstitute peer's public key", local_addr);
}
}
代码示例来源:origin: wildfly/wildfly
protected void handleSecretKeyResponse(final Message msg, final byte[] key_version) {
if(!inView(msg.src(), "ignoring secret key sent by %s which is not in current view %s"))
return;
if(Arrays.equals(sym_version, key_version)) {
log.debug("%s: secret key (version %s) already installed, ignoring key response from %s",
local_addr, Util.byteArrayToHexString(key_version), msg.src());
return;
}
try {
SecretKey tmp=decodeKey(msg.getBuffer());
if(tmp == null)
sendKeyRequest(key_server_addr); // unable to understand response, let's try again
else
setKeys(msg.src(), tmp, key_version); // otherwise set the received key as the shared key
}
catch(Exception e) {
log.warn("%s: unable to process key received from %s: %s", local_addr, msg.src(), e);
}
}
代码示例来源:origin: wildfly/wildfly
applyNewConfig(msg.getBuffer());
break;
代码示例来源:origin: apache/geode
byte[] contents = jgmsg.getBuffer();
if (contents == null) {
return;
代码示例来源:origin: wildfly/wildfly
byte[] buf=frag_table.add(hdr.id, hdr.frag_id, hdr.num_frags, msg.getBuffer());
if(buf == null)
return null;
代码示例来源:origin: wildfly/wildfly
public Object up(Message msg) {
StateHeader hdr=msg.getHeader(this.id);
if(hdr == null)
return up_prot.up(msg);
switch(hdr.type) {
case StateHeader.STATE_REQ:
state_requesters.add(msg.getSrc());
break;
case StateHeader.STATE_RSP:
handleStateRsp(hdr.getDigest(), msg.getSrc(), msg.getBuffer());
break;
case StateHeader.STATE_EX:
closeHoleFor(msg.getSrc());
try {
handleException(Util.exceptionFromBuffer(msg.getRawBuffer(), msg.getOffset(), msg.getLength()));
}
catch(Throwable t) {
log.error("failed deserializaing state exception", t);
}
break;
default:
log.error("%s: type %s not known in StateHeader", local_addr, hdr.type);
break;
}
return null;
}
代码示例来源:origin: org.hornetq/hornetq-core-client
@Override
public void receive(org.jgroups.Message msg)
{
dequeue.add(msg.getBuffer());
}
代码示例来源:origin: org.apache.activemq/artemis-core-client
@Override
public void receive(org.jgroups.Message msg) {
if (logger.isTraceEnabled())
logger.trace("sending message " + msg);
dequeue.add(msg.getBuffer());
}
代码示例来源:origin: apache/activemq-artemis
@Override
public void receive(org.jgroups.Message msg) {
if (logger.isTraceEnabled())
logger.trace("sending message " + msg);
dequeue.add(msg.getBuffer());
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
@Override
public void receive(org.jgroups.Message msg) {
if (logger.isTraceEnabled())
logger.trace("sending message " + msg);
dequeue.add(msg.getBuffer());
}
代码示例来源:origin: fenix-framework/fenix-framework
@Override
public void receive(Message msg) {
super.receive(msg);
String barrierName = new String(msg.getBuffer());
getOrAdd(barrierName).addMember(msg.getSrc());
}
代码示例来源:origin: org.codehaus.fabric3/fabric3-federation-jgroups
public void receive(Message message) {
if (message.getSrc() != channel.getAddress()) {
try {
Object payload = helper.deserialize(message.getBuffer());
delegate.onMessage(payload);
} catch (MessageException e) {
monitor.error("Error deserializing message payload", e);
}
}
}
代码示例来源:origin: org.codehaus.fabric3/fabric3-federation-jgroups
public void receive(Message msg) {
try {
String runtimeName = org.jgroups.util.UUID.get(msg.getSrc());
monitor.receiveMessage(runtimeName);
Command command = (Command) helper.deserialize(msg.getBuffer());
executorRegistry.execute(command);
} catch (MessageException e) {
monitor.error("Error receiving message from: " + runtimeName, e);
} catch (ExecutionException e) {
monitor.error("Error receiving message from: " + runtimeName, e);
}
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
protected void handleSecretKeyRequest(final Message msg) {
if(!inView(msg.src(), "key requester %s is not in current view %s; ignoring key request"))
return;
log.debug("%s: received secret key request from %s", local_addr, msg.getSrc());
try {
PublicKey tmpKey=generatePubKey(msg.getBuffer());
sendSecretKey(secret_key, tmpKey, msg.getSrc());
}
catch(Exception e) {
log.warn("%s: unable to reconstitute peer's public key", local_addr);
}
}
代码示例来源:origin: org.ow2.cmi/cmi-ha
public void sendMessage(final HaMessageData messageData) {
Message message = new Message(null, null, messageData);
// Compute statistics
messagesNumber++;
messagesSize += message.size();
RspList rspList = dispatcher.castMessage(null, message, GroupRequest.GET_FIRST, 0);
if (logger.isDebugEnabled()) {
Address localAddress = dispatcher.getChannel().getLocalAddress();
logger.debug("Message sended. Length: " + message.getBuffer().length + " From: " + localAddress);
logger.debug("Response: " + rspList.toString());
}
}
内容来源于网络,如有侵权,请联系作者删除!