本文整理汇总了Java中org.jgroups.util.UUID.get方法的典型用法代码示例。如果您正苦于以下问题:Java UUID.get方法的具体用法?Java UUID.get怎么用?Java UUID.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jgroups.util.UUID
的用法示例。
在下文中一共展示了UUID.get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: up
import org.jgroups.util.UUID; //导入方法依赖的package包/类
public void up(MessageBatch batch) {
for(Message msg: batch) {
Relay2Header hdr=(Relay2Header)msg.getHeader(id);
Address dest=msg.getDest();
if(hdr == null) {
// forward a multicast message to all bridges except myself, then pass up
if(dest == null && is_site_master && relay_multicasts && !msg.isFlagSet(Message.Flag.NO_RELAY)) {
Address src=msg.getSrc();
Address sender=new SiteUUID((UUID)msg.getSrc(), UUID.get(msg.getSrc()), site);
if(src instanceof ExtendedUUID)
((SiteUUID)sender).addContents((ExtendedUUID)src);
sendToBridges(sender, msg, site);
}
}
else { // header is not null
batch.remove(msg); // message is consumed
if(dest != null)
handleMessage(hdr, msg);
else
deliver(null, hdr.original_sender, msg);
}
}
if(!batch.isEmpty())
up_prot.up(batch);
}
示例2: sendDiscoveryRequest
import org.jgroups.util.UUID; //导入方法依赖的package包/类
protected void sendDiscoveryRequest(String cluster_name, List<Address> members_to_find) throws Exception {
PhysicalAddress physical_addr=(PhysicalAddress)down(new Event(Event.GET_PHYSICAL_ADDRESS, local_addr));
// https://issues.jboss.org/browse/JGRP-1670
PingData data=new PingData(local_addr, false, UUID.get(local_addr), physical_addr);
PingHeader hdr=new PingHeader(PingHeader.GET_MBRS_REQ).clusterName(cluster_name);
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
Message msg=new Message(null).putHeader(getId(),hdr).setBuffer(marshal(data))
.setFlag(Message.Flag.INTERNAL,Message.Flag.DONT_BUNDLE,Message.Flag.OOB)
.setTransientFlag(Message.TransientFlag.DONT_LOOPBACK);
sendMcastDiscoveryRequest(msg);
}
示例3: print
import org.jgroups.util.UUID; //导入方法依赖的package包/类
public String print(final Address logical_addr, final LazyRemovalCache.Entry<PhysicalAddress> entry) {
StringBuilder sb=new StringBuilder();
String tmp_logical_name=UUID.get(logical_addr);
if(tmp_logical_name != null)
sb.append(tmp_logical_name).append(": ");
if(logical_addr instanceof UUID)
sb.append(((UUID)logical_addr).toStringLong());
else
sb.append(logical_addr);
sb.append(": ").append(entry).append("\n");
return sb.toString();
}
示例4: handleView
import org.jgroups.util.UUID; //导入方法依赖的package包/类
public void handleView(View view) {
members=view.getMembers(); // First, save the members for routing received messages to local members
List<Address> old_site_masters=site_masters;
List<Address> new_site_masters=determineSiteMasters(view);
boolean become_site_master=new_site_masters.contains(local_addr)
&& (old_site_masters == null || !old_site_masters.contains(local_addr));
boolean cease_site_master=old_site_masters != null
&& old_site_masters.contains(local_addr) && !new_site_masters.contains(local_addr);
site_masters=new_site_masters;
if(become_site_master) {
is_site_master=true;
final String bridge_name="_" + UUID.get(local_addr);
if(relayer != null)
relayer.stop();
relayer=new Relayer(this, log);
final Relayer tmp=relayer;
if(async_relay_creation) {
timer.execute(new Runnable() {
public void run() {
startRelayer(tmp, bridge_name);
}
});
}
else
startRelayer(relayer, bridge_name);
}
else {
if(cease_site_master) { // ceased being the site master: stop the relayer
is_site_master=false;
log.trace(local_addr + ": ceased to be site master; closing bridges");
if(relayer != null)
relayer.stop();
}
}
}
示例5: readCacheFromDisk
import org.jgroups.util.UUID; //导入方法依赖的package包/类
/** Reads all mappings from disk */
protected synchronized void readCacheFromDisk() {
if(log.isDebugEnabled())
log.debug("reading all mappings from disk cache " + root_dir);
File[] files=root_dir.listFiles(filter);
if(files == null)
return;
for(File file: files) {
// implementing a simple spin lock doing a few attempts to read the file
// this is done since the file may be written in concurrency and may therefore not be readable
Mapping data=null;
for(int i=0; i < 3; i++) {
data=null;
if(file.exists())
data=readAddressMapping(file);
if(data != null)
break;
else
Util.sleep(100);
}
if(data == null) {
log.warn("failed parsing content in " + file.getAbsolutePath() + ": removing it ");
deleteFile(file);
}
else {
if(data != null && data.getLogicalAddr() != null && data.getPhysicalAddr() != null) {
cache.put(data.getLogicalAddr(), (PhysicalAddress)data.getPhysicalAddr());
if(data.getLogicalName() != null && UUID.get(data.getLogicalAddr()) == null)
UUID.add(data.getLogicalAddr(), data.getLogicalName());
}
}
}
}
示例6: addressToFilename
import org.jgroups.util.UUID; //导入方法依赖的package包/类
protected static String addressToFilename(Address mbr) {
String logical_name=UUID.get(mbr);
return (addressAsString(mbr) + (logical_name != null? "." + logical_name + SUFFIX : SUFFIX))
.replace(File.separatorChar, '-');
}
示例7: getName
import org.jgroups.util.UUID; //导入方法依赖的package包/类
public String getName(Address member) {return member != null? UUID.get(member) : null;}