/** * Atomically checks if a given flag is set and - if not - sets it. When multiple threads * concurrently call this method with the same flag, only one of them will be able to set the * flag * * @param flag * @return True if the flag could be set, false if not (was already set) */ public synchronized boolean setTransientFlagIfAbsent(TransientFlag flag) { if(isTransientFlagSet(flag)) return false; setTransientFlag(flag); return true; }
public void send(org.jgroups.Message msg) throws Exception { if (logger.isTraceEnabled()) logger.trace(this + "::Sending JGroups Message: Open=" + channel.isOpen() + " on channel " + channelName + " msg=" + msg); if (!manager.isLoopbackMessages()) { msg.setTransientFlag(Message.TransientFlag.DONT_LOOPBACK); } channel.send(msg); }
protected void execute(long seqno) { if(seqno == 0 || skip_next_resend.compareAndSet(true,false)) return; if(seqno == last_seqno_resent && num_resends >= resend_last_seqno_max_times) return; if(seqno > last_seqno_resent) { last_seqno_resent=seqno; num_resends=1; } else num_resends++; Message msg=new Message(null).putHeader(id, NakAckHeader2.createHighestSeqnoHeader(seqno)) .setFlag(Message.Flag.OOB, Message.Flag.INTERNAL) .setTransientFlag(Message.TransientFlag.DONT_LOOPBACK); // we don't need to receive our own broadcast down_prot.down(msg); } }
/** Sends or broadcasts a I_HAVE_SOCK response. If 'dst' is null, the reponse will be broadcast, otherwise it will be unicast back to the requester */ protected void sendIHaveSockMessage(Address dst, Address mbr, IpAddress addr) { Message msg=new Message(dst).setFlag(Message.Flag.INTERNAL).setTransientFlag(Message.TransientFlag.DONT_LOOPBACK); FdHeader hdr=new FdHeader(FdHeader.I_HAVE_SOCK, mbr); hdr.sock_addr=addr; msg.putHeader(this.id, hdr); down_prot.down(msg); }
protected void multicastOwnMapping() { String logical_name=NameCache.get(local_addr); if(logical_name != null) { Message msg=new Message(null).setFlag(Message.Flag.OOB).setTransientFlag(Message.TransientFlag.DONT_LOOPBACK) .putHeader(id, new Header(Type.CACHE_RSP, local_addr, logical_name)); down_prot.down(msg); } }
void setMessageFlags(DistributionMessage gfmsg, Message msg) { // Bundling is mostly only useful if we're doing no-ack work, // which is fairly rare msg.setFlag(Flag.DONT_BUNDLE); if (gfmsg.getProcessorType() == ClusterDistributionManager.HIGH_PRIORITY_EXECUTOR || gfmsg instanceof HighPriorityDistributionMessage || AlertingAction.isThreadAlerting()) { msg.setFlag(Flag.OOB); msg.setFlag(Flag.NO_FC); msg.setFlag(Flag.SKIP_BARRIER); } if (gfmsg instanceof DistributedCacheOperation.CacheOperationMessage) { // we don't want to see our own cache operation messages msg.setTransientFlag(Message.TransientFlag.DONT_LOOPBACK); } }
public void run() { if(view == null) { log.warn("%s: view is null, cannot send INFO message", local_addr); return; } MergeHeader hdr=createInfo(); if(transport_supports_multicasting) { // mcast the discovery request to all but self Message msg=new Message().setFlag(Message.Flag.INTERNAL).putHeader(getId(), hdr) .setTransientFlag(Message.TransientFlag.DONT_LOOPBACK); down_prot.down(msg); return; } down_prot.down(ASYNC_DISCOVERY_EVENT); }
key_requesters=new ResponseCollectorTask<Boolean>(targets) .setPeriodicTask(c -> { Message msg=new Message(null).setTransientFlag(Message.TransientFlag.DONT_LOOPBACK) .putHeader(id, new EncryptHeader(EncryptHeader.NEW_KEYSERVER, sym_version)); down_prot.down(msg);
/** Sends a request to a single destination */ public void sendUnicastRequest(Address dest, Buffer data, Request req, RequestOptions opts) throws Exception { if(transport == null) { if(log.isWarnEnabled()) log.warn("transport is not available !"); return; } Header hdr=new Header(Header.REQ, 0, this.corr_id); Message msg=new Message(dest, data).putHeader(this.corr_id, hdr) .setFlag(opts.flags()).setTransientFlag(opts.transientFlags()); if(req != null) { // sync RPC long req_id=REQUEST_ID.getAndIncrement(); req.requestId(req_id); hdr.requestId(req_id); // set the request-id only for *synchronous RPCs* if(log.isTraceEnabled()) log.trace("%s: invoking unicast RPC [req-id=%d] on %s", local_addr, req_id, msg.dest()); requests.putIfAbsent(req_id, req); // make sure no view is received before we add ourself as a view handler (https://issues.jboss.org/browse/JGRP-1428) req.viewChange(view); if(rpc_stats.extendedStats()) req.start_time=System.nanoTime(); } else // async RPC rpc_stats.add(RpcStats.Type.UNICAST, dest, false, 0); transport.down(msg); }
protected void sendDiscoveryRequest(String cluster_name, List<Address> members_to_find, boolean initial_discovery) throws Exception { PingData data=null; if(!use_ip_addrs || !initial_discovery) { PhysicalAddress physical_addr=(PhysicalAddress)down(new Event(Event.GET_PHYSICAL_ADDRESS, local_addr)); // https://issues.jboss.org/browse/JGRP-1670 data=new PingData(local_addr, false, NameCache.get(local_addr), physical_addr); if(members_to_find != null && members_to_find.size() <= max_members_in_discovery_request) data.mbrs(members_to_find); } // message needs to have DONT_BUNDLE flag: if A sends message M to B, and we need to fetch B's physical // address, then the bundler thread blocks until the discovery request has returned. However, we cannot send // the discovery *request* until the bundler thread has returned from sending M PingHeader hdr=new PingHeader(PingHeader.GET_MBRS_REQ).clusterName(cluster_name).initialDiscovery(initial_discovery); Message msg=new Message(null).putHeader(getId(),hdr) .setFlag(Message.Flag.INTERNAL,Message.Flag.DONT_BUNDLE,Message.Flag.OOB) .setTransientFlag(Message.TransientFlag.DONT_LOOPBACK); if(data != null) msg.setBuffer(marshal(data)); sendMcastDiscoveryRequest(msg); }
jmsg.setTransientFlag(TransientFlag.DONT_LOOPBACK); if (!reliably) { jmsg.setFlag(Message.Flag.NO_RELIABILITY);
.setFlag(opts.flags()).setTransientFlag(opts.transientFlags());
.setBuffer(marshal(new_view, digest)).setTransientFlag(Message.TransientFlag.DONT_LOOPBACK); if(new_view instanceof MergeView) // https://issues.jboss.org/browse/JGRP-1484 view_change_msg.setFlag(Message.Flag.NO_TOTAL_ORDER);
/** * Atomically checks if a given flag is set and - if not - sets it. When multiple threads * concurrently call this method with the same flag, only one of them will be able to set the * flag * * @param flag * @return True if the flag could be set, false if not (was already set) */ public synchronized boolean setTransientFlagIfAbsent(TransientFlag flag) { if(isTransientFlagSet(flag)) return false; setTransientFlag(flag); return true; }
public void send(org.jgroups.Message msg) throws Exception { if (logger.isTraceEnabled()) logger.trace(this + "::Sending JGroups Message: Open=" + channel.isOpen() + " on channel " + channelName + " msg=" + msg); if (!manager.isLoopbackMessages()) { msg.setTransientFlag(Message.TransientFlag.DONT_LOOPBACK); } channel.send(msg); }
public void send(org.jgroups.Message msg) throws Exception { if (logger.isTraceEnabled()) logger.trace(this + "::Sending JGroups Message: Open=" + channel.isOpen() + " on channel " + channelName + " msg=" + msg); if (!manager.isLoopbackMessages()) { msg.setTransientFlag(Message.TransientFlag.DONT_LOOPBACK); } channel.send(msg); }
public void send(org.jgroups.Message msg) throws Exception { if (logger.isTraceEnabled()) logger.trace(this + "::Sending JGroups Message: Open=" + channel.isOpen() + " on channel " + channelName + " msg=" + msg); if (!manager.isLoopbackMessages()) { msg.setTransientFlag(Message.TransientFlag.DONT_LOOPBACK); } channel.send(msg); }
/** Sends or broadcasts a I_HAVE_SOCK response. If 'dst' is null, the reponse will be broadcast, otherwise it will be unicast back to the requester */ protected void sendIHaveSockMessage(Address dst, Address mbr, IpAddress addr) { Message msg=new Message(dst).setFlag(Message.Flag.INTERNAL).setTransientFlag(Message.TransientFlag.DONT_LOOPBACK); FdHeader hdr=new FdHeader(FdHeader.I_HAVE_SOCK, mbr); hdr.sock_addr=addr; msg.putHeader(this.id, hdr); down_prot.down(msg); }
protected void multicastOwnMapping() { String logical_name=NameCache.get(local_addr); if(logical_name != null) { Message msg=new Message(null).setFlag(Message.Flag.OOB).setTransientFlag(Message.TransientFlag.DONT_LOOPBACK) .putHeader(id, new Header(Type.CACHE_RSP, local_addr, logical_name)); down_prot.down(msg); } }
public void run() { if(view == null) { log.warn("%s: view is null, cannot send INFO message", local_addr); return; } MergeHeader hdr=createInfo(); if(transport_supports_multicasting) { // mcast the discovery request to all but self Message msg=new Message().setFlag(Message.Flag.INTERNAL).putHeader(getId(), hdr) .setTransientFlag(Message.TransientFlag.DONT_LOOPBACK); down_prot.down(msg); return; } down_prot.down(ASYNC_DISCOVERY_EVENT); }