org.jgroups.util.UUID.get()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中org.jgroups.util.UUID.get()方法的一些代码示例,展示了UUID.get()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UUID.get()方法的具体详情如下:
包路径:org.jgroups.util.UUID
类名称:UUID
方法名:get

UUID.get介绍

[英]Returns the most significant 64 bits of this UUID's 128 bit value.
[中]返回此UUID的128位值中最重要的64位。

代码示例

代码示例来源:origin: org.codehaus.fabric3/fabric3-federation-jgroups

public String getZoneName(Address address) {
  String name = UUID.get(address);
  if (name == null) {
    return null;
  }
  int pos = name.indexOf(":participant:");
  if (pos < 0) {
    return null;
  }
  return name.substring(pos + 13, name.lastIndexOf(":"));
}

代码示例来源:origin: org.codehaus.fabric3/fabric3-federation-jgroups

public void suspect(Address suspected) {
  String runtimeName = UUID.get(suspected);
  for (TopologyListener listener : topologyListeners) {
    listener.onLeave(runtimeName);
  }
}

代码示例来源:origin: org.codehaus.fabric3/fabric3-federation-jgroups

public Address getController(View view) {
  for (Address address : view.getMembers()) {
    String name = UUID.get(address);
    if (name != null && name.substring(name.indexOf(":")).startsWith(":controller:")) {
      return address;
    }
  }
  return null;
}

代码示例来源:origin: org.codehaus.fabric3/fabric3-federation-jgroups

public Address getRuntimeAddress(String runtimeName, View view) {
  for (Address address : view.getMembers()) {
    String name = UUID.get(address);
    if (runtimeName.equals(name)) {
      return address;
    }
  }
  return null;
}

代码示例来源:origin: org.codehaus.fabric3/fabric3-federation-jgroups

public List<Address> getRuntimeAddressesInZone(String zoneName, View view) {
  List<Address> runtimes = new ArrayList<Address>();
  for (Address address : view.getMembers()) {
    String name = UUID.get(address);
    if (name == null) {
      continue;
    }
    int pos = name.indexOf(":participant");
    if (pos < 0) {
      continue;
    }
    if (name.substring(pos + 12).startsWith(":" + zoneName + ":")) {
      runtimes.add(address);
    }
  }
  return runtimes;
}

代码示例来源:origin: org.codehaus.fabric3/fabric3-federation-jgroups

public Address getZoneLeader(String zoneName, View view) {
  for (Address address : view.getMembers()) {
    String name = UUID.get(address);
    if (name == null) {
      return null;
    }
    int pos = name.indexOf(":participant:");
    if (pos < 0) {
      continue;
    }
    name = name.substring(pos + 13);
    name = name.substring(0, name.indexOf(":"));
    if (zoneName.equals(name)) {
      return address;
    }
  }
  return null;
}

代码示例来源:origin: org.codehaus.fabric3/fabric3-federation-jgroups

@ManagementOperation(description = "The runtimes in the domain")
public List<String> getRuntimeNames() {
  List<String> runtimes = new ArrayList<String>();
  for (Address member : domainChannel.getView().getMembers()) {
    String name = org.jgroups.util.UUID.get(member);
    runtimes.add(name);
  }
  return runtimes;
}

代码示例来源:origin: org.codehaus.fabric3/fabric3-federation-jgroups

public void viewAccepted(View newView) {
  synchronized (viewLock) {
    try {
      Set<Address> newZoneLeaders = helper.getNewZoneLeaders(previousView, newView);
      Set<Address> newRuntimes = helper.getNewRuntimes(previousView, newView);
      previousView = newView;
      if (newZoneLeaders.isEmpty() && newRuntimes.isEmpty()) {
        return;
      }
      for (Address address : newRuntimes) {
        String name = UUID.get(address);
        for (TopologyListener listener : topologyListeners) {
          listener.onJoin(name);
        }
      }
      for (Address address : newZoneLeaders) {
        String name = UUID.get(address);
        for (TopologyListener listener : topologyListeners) {
          listener.onLeaderElected(name);
        }
      }
    } finally {
      viewLock.notifyAll();
    }
  }
}

代码示例来源:origin: org.codehaus.fabric3/fabric3-federation-jgroups

@ManagementOperation(description = "The name of the zone leader")
public String getZoneLeaderName() {
  View view = domainChannel.getView();
  if (view == null) {
    return null;
  }
  Address address = helper.getZoneLeader(zoneName, view);
  if (address == null) {
    return null;
  }
  return UUID.get(address);
}

代码示例来源:origin: org.codehaus.fabric3/fabric3-federation-jgroups

public void suspect(Address suspected) {
  String name = helper.getZoneName(suspected);
  if (name == null) {
    return;
  }
  String runtimeName = UUID.get(suspected);
  monitor.runtimeRemoved(runtimeName);
  // Member is suspected. If it is a zone leader, remove the metadata from the cache
  View view = domainChannel.getView();
  if (view == null) {
    return;
  }
  if (suspected.equals(helper.getZoneLeader(name, view))) {
    transportMetadata.remove(name);
  }
  Map<String, RuntimeInstance> instances = runtimes.get(name);
  if (instances != null) {
    instances.remove(runtimeName);
    if (instances.isEmpty()) {
      runtimes.remove(name);
    }
  }
  for (TopologyListener listener : topologyListeners) {
    listener.onLeave(runtimeName);
  }
}

代码示例来源:origin: org.codehaus.fabric3/fabric3-federation-jgroups

response.setRuntimeName(UUID.get(address));
    responses.add(response);
    if (failFast) {
  response.setRuntimeName(UUID.get(address));
  responses.add(response);
  break;
} catch (SuspectedException e) {
  RemoteSystemException response = new RemoteSystemException(e);
  response.setRuntimeName(UUID.get(address));
  responses.add(response);
  break;
} catch (MessageException e) {
  RemoteSystemException response = new RemoteSystemException(e);
  response.setRuntimeName(UUID.get(address));
  responses.add(response);
  break;
} catch (Exception e) {
  RemoteSystemException response = new RemoteSystemException(e);
  response.setRuntimeName(UUID.get(address));
  responses.add(response);
  break;

代码示例来源:origin: org.codehaus.fabric3/fabric3-federation-jgroups

RuntimeMetadataUpdateCommand runtimeCommand = new RuntimeMetadataUpdateCommand();
for (Address address : newZoneLeaders) {
  String name = UUID.get(address);
  monitor.metadataUpdateRequest(name);
  Response value = sendSynchronous(name, zoneCommand, defaultTimeout);
  String name = UUID.get(address);
  for (TopologyListener listener : topologyListeners) {
    listener.onJoin(name);

代码示例来源: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: io.fabric8/fabric8-jgroups

@Override
public void findMembers(List<Address> members, boolean initial_discovery, Responses responses) {
  kubernetesHosts = findKubernetesHosts();
  
  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, org.jgroups.util.UUID.get(local_addr), physical_addr);
  PingHeader hdr = new PingHeader(PingHeader.GET_MBRS_REQ).clusterName(cluster_name);
  Set<PhysicalAddress> cluster_members = new HashSet<>(kubernetesHosts);
  cluster_members.addAll(dynamic_hosts);
  if (use_disk_cache) {
    // this only makes sense if we have PDC below us
    Collection<PhysicalAddress> list = (Collection<PhysicalAddress>) down_prot.down(new Event(Event.GET_PHYSICAL_ADDRESSES));
    if (list != null)
      for (PhysicalAddress phys_addr : list)
        if (!cluster_members.contains(phys_addr))
          cluster_members.add(phys_addr);
  }
  for (final PhysicalAddress addr : cluster_members) {
    if (physical_addr != null && addr.equals(physical_addr)) // no need to send the request to myself
      continue;
    // the message needs to be DONT_BUNDLE, see explanation above
    final Message msg = new Message(addr).setFlag(Message.Flag.INTERNAL, Message.Flag.DONT_BUNDLE, Message.Flag.OOB)
        .putHeader(this.id, hdr).setBuffer(marshal(data));
    log.trace("%s: sending discovery request to %s", local_addr, msg.getDest());
    down_prot.down(new Event(Event.MSG, msg));
  }
}

代码示例来源:origin: org.codehaus.fabric3/fabric3-federation-jgroups

String name = UUID.get(address);
monitor.updating(name);
RuntimeUpdateCommand command = new RuntimeUpdateCommand(runtimeName, zoneName, null);

代码示例来源:origin: org.codehaus.fabric3/fabric3-federation-jgroups

public Object handle(Message msg) {
  try {
    String runtimeName = org.jgroups.util.UUID.get(msg.getSrc());
    monitor.handleMessage(runtimeName);
    Object deserialized = helper.deserialize(msg.getBuffer());

相关文章