本文整理了Java中org.jgroups.Message.dest()
方法的一些代码示例,展示了Message.dest()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.dest()
方法的具体详情如下:
包路径:org.jgroups.Message
类名称:Message
方法名:dest
暂无
代码示例来源:origin: wildfly/wildfly
protected void _addMessage(Message msg, long size) {
target_dest=msg.dest();
target_list.add(msg);
count+=size;
}
代码示例来源:origin: wildfly/wildfly
public void loopback(Message msg, boolean oob, boolean internal) {
if(oob || internal) {
super.loopback(msg, oob, internal);
return;
}
MessageTable table=msg.dest() == null? mcasts : ucasts;
table.process(msg, true);
}
代码示例来源:origin: wildfly/wildfly
public static String dump(byte[] buf, int offset, int length) {
StringBuilder sb=new StringBuilder();
List<Message> msgs=parse(new ByteArrayInputStream(buf, offset, length));
if(msgs != null)
for(Message msg: msgs)
sb.append(String.format("dst=%s src=%s (%d bytes): hdrs= %s\n", msg.dest(), msg.src(), msg.getLength(), msg.printHeaders()));
return sb.toString();
}
代码示例来源:origin: wildfly/wildfly
protected void queue(Message msg) {
Address dest=msg.dest();
Map<Address,List<Message>> map;
if(dest == null)
map=msg.isFlagSet(Message.Flag.OOB)? oob_map_mcast : reg_map_mcast;
else
map=msg.isFlagSet(Message.Flag.OOB)? oob_map_ucast : reg_map_ucast;
Address sender=msg.src();
synchronized(map) {
List<Message> list=map.get(sender);
if(list == null)
map.put(sender, list=new ArrayList<>());
list.add(msg);
}
}
代码示例来源:origin: wildfly/wildfly
public void process(Message msg, boolean oob, boolean internal) {
if(oob || internal) {
super.process(msg, oob, internal);
return;
}
MessageTable table=msg.dest() == null? mcasts : ucasts;
table.process(msg, false);
}
代码示例来源:origin: wildfly/wildfly
public Object down(Message msg) {
System.out.println("------------------- TRACE (sent) -----------------------");
System.out.printf("msg from %s to %s (%d bytes): hdrs=%s\n", msg.src(), msg.dest(), msg.length(), msg.printHeaders());
System.out.println("--------------------------------------------------------");
return down_prot.down(msg);
}
代码示例来源:origin: wildfly/wildfly
public void loopback(Message msg, boolean oob, boolean internal) {
tp.submitToThreadPool(() -> tp.passMessageUp(msg, null, false, msg.dest() == null,false), internal);
}
代码示例来源:origin: wildfly/wildfly
public Object down(Message msg) {
if(print_down)
System.out.printf("-- to %s (%d bytes): %s\n", msg.dest(), msg.getLength(), msg.printHeaders());
return down_prot.down(msg); // Pass on to the layer below us
}
代码示例来源:origin: wildfly/wildfly
protected static void dump(GossipData data) {
System.out.println("");
List<Message> messages=Util.parse(data.buffer, data.offset, data.length);
if(messages != null)
for(Message msg : messages)
System.out.printf("dst=%s src=%s (%d bytes): hdrs= %s\n", msg.dest(), msg.src(), msg.getLength(), msg.printHeaders());
}
代码示例来源:origin: wildfly/wildfly
public Object up(Message msg) {
if(msg.isFlagSet(Message.Flag.OOB) && msg.isFlagSet(Message.Flag.INTERNAL))
return up_prot.up(msg);
if((msg.dest() == null && multicasts) || (msg.dest() != null && unicasts)) {
queue(msg);
return null;
}
return up_prot.up(msg);
}
代码示例来源:origin: wildfly/wildfly
protected void process(Message msg, boolean loopback) {
Address dest=msg.dest(), sender=msg.src();
get(dest, sender).process(msg, loopback);
}
代码示例来源:origin: wildfly/wildfly
public Object down(Message msg) {
try {
if(secret_key == null) {
log.trace("%s: discarded %s message to %s as secret key is null, hdrs: %s",
local_addr, msg.dest() == null? "mcast" : "unicast", msg.dest(), msg.printHeaders());
secretKeyNotAvailable();
return null;
}
encryptAndSend(msg);
}
catch(Exception e) {
log.warn("%s: unable to send message down", local_addr, e);
}
return null;
}
代码示例来源:origin: wildfly/wildfly
public Object down(Message msg) {
Address dest;
if((dest=msg.dest()) == null) // we only handle unicast messages
return down_prot.down(msg);
Entry entry=getEntry(send_map, dest);
entry.send(msg);
return null;
}
代码示例来源:origin: wildfly/wildfly
protected void dropped(Message msg, boolean down) {
log.trace("dropped msg %s hdrs: %s\n", down? "to " + msg.dest() : "from " + msg.src(), msg.printHeaders());
}
}
代码示例来源:origin: wildfly/wildfly
protected void sendDiscoveryRequest(Message req) {
try {
log.trace("%s: sending discovery request to %s", local_addr, req.getDest());
down_prot.down(req);
}
catch(Throwable t) {
log.trace("sending discovery request to %s failed: %s", req.dest(), t);
}
}
}
代码示例来源:origin: wildfly/wildfly
protected void sendDiscoveryRequest(Message req) {
try {
log.trace("%s: sending discovery request to %s", local_addr, req.getDest());
down_prot.down(req);
} catch (Throwable t) {
log.error("sending discovery request to %s failed: %s", req.dest(), t);
}
}
}
代码示例来源:origin: wildfly/wildfly
protected void deliver(Address dest, Address sender, final Message msg) {
try {
Message copy=copy(msg).dest(dest).src(sender);
if(log.isTraceEnabled())
log.trace(local_addr + ": delivering message from " + sender);
long start=stats? System.nanoTime() : 0;
up_prot.up(copy);
if(stats) {
local_delivery_time.add(System.nanoTime() - start);
local_deliveries.increment();
}
}
catch(Exception e) {
log.error(Util.getMessage("FailedDeliveringMessage"), e);
}
}
代码示例来源:origin: wildfly/wildfly
protected int marshalMessagesToSameDestination(Address dest, Message[] buf, final int start_index, final int end_index,
int max_bundle_size) throws Exception {
int num_msgs=0, bytes=0;
for(int i=start_index; i != end_index; i=increment(i)) {
Message msg=buf[i];
if(msg != null && msg != NULL_MSG && Objects.equals(dest, msg.dest())) {
long msg_size=msg.size();
if(bytes + msg_size > max_bundle_size)
break;
bytes+=msg_size;
num_msgs++;
buf[i]=NULL_MSG;
msg.writeToNoAddrs(msg.src(), output, transport.getId());
}
}
return num_msgs;
}
代码示例来源:origin: wildfly/wildfly
protected Message createMessage(Address target, Address final_destination, Address original_sender, final Message msg) {
Message copy=relay.copy(msg).dest(target).src(null);
RELAY2.Relay2Header hdr=new RELAY2.Relay2Header(RELAY2.Relay2Header.DATA, final_destination, original_sender);
copy.putHeader(relay.getId(), hdr);
return copy;
}
}
代码示例来源:origin: wildfly/wildfly
protected void forwardTo(Address next_dest, SiteAddress final_dest, Address original_sender, final Message msg,
boolean forward_to_current_coord) {
if(log.isTraceEnabled())
log.trace(local_addr + ": forwarding message to final destination " + final_dest + " to " +
(forward_to_current_coord? " the current coordinator" : next_dest));
Message copy=copy(msg).dest(next_dest).src(null);
Relay2Header hdr=new Relay2Header(Relay2Header.DATA, final_dest, original_sender);
copy.putHeader(id,hdr);
if(forward_to_current_coord && forwarding_protocol_present)
down_prot.down(new Event(Event.FORWARD_TO_COORD, copy));
else
down_prot.down(copy);
}
内容来源于网络,如有侵权,请联系作者删除!