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(":")); }
public void suspect(Address suspected) { String runtimeName = UUID.get(suspected); for (TopologyListener listener : topologyListeners) { listener.onLeave(runtimeName); } }
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; }
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; }
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; }
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; }
@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; }
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(); } } }
@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); }
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); } }
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;
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);
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); } }
@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)); } }
String name = UUID.get(address); monitor.updating(name); RuntimeUpdateCommand command = new RuntimeUpdateCommand(runtimeName, zoneName, null);
public Object handle(Message msg) { try { String runtimeName = org.jgroups.util.UUID.get(msg.getSrc()); monitor.handleMessage(runtimeName); Object deserialized = helper.deserialize(msg.getBuffer());