public Integer call() throws Exception { System.out.println("Running a computation heavy task on " + hz.getCluster().getLocalMember()); return 0; } }
@Override public Object getLocalMember() { return this.hz.getCluster().getLocalMember(); }
/** * Return the name of the current Hazelcast instance. */ @Override public String call() throws Exception { String uuid = hazelcastInstance.getCluster().getLocalMember().getUuid(); log.info("call() runs on {}", uuid); return uuid; }
@Override public String getInstance() { intitialize(); return hazelCast.getCluster().getLocalMember().toString(); }
HazelcastCommunicator(final HazelcastInstance hazelcast, final String communicatorName){ super(hazelcast, communicatorName, HazelcastInstance::getTopic); this.hazelcast = Objects.requireNonNull(hazelcast); localMember = hazelcast.getCluster().getLocalMember().getUuid(); }
public static void main(String[] args) { HazelcastInstance node1 = Hazelcast.newHazelcastInstance(); HazelcastInstance node2 = Hazelcast.newHazelcastInstance(); Member member2 = node2.getCluster().getLocalMember(); boolean member2Safe = node1.getPartitionService().isMemberSafe(member2); System.out.printf("# Is member2 safe for shutdown\t: %s\n", member2Safe); } }
public void setNodeAlias(String alias) { Cluster cluster = instance.getCluster(); if (cluster != null) { Member member = cluster.getLocalMember(); member.setStringAttribute("alias", alias); } }
/** * Gets address of this node. * * @return Address of this node. */ @Override public InetSocketAddress getAddress() { return hazelcast.getCluster().getLocalMember().getSocketAddress(); }
private void signalStartToAgent() { String address; if (serverInstance == null) { address = "client:" + getHostAddress(); } else { InetSocketAddress socketAddress = serverInstance.getCluster().getLocalMember().getInetSocketAddress(); address = socketAddress.getAddress().getHostAddress() + ":" + socketAddress.getPort(); } File file = new File("worker.address"); writeObject(address, file); }
private Address getThisAddress(HazelcastInstance hazelcastInstance) { try { return hazelcastInstance.getCluster().getLocalMember().getAddress(); } catch (UnsupportedOperationException e) { return null; } }
@Override public CompositeData call() throws Exception { int[] counters = hMgr.getCounters(); Map<String, Object> result = new HashMap<>(3); result.put("Active docs", counters[0]); result.put("Inactive docs", counters[1]); Member m = hzInstance.getCluster().getLocalMember(); result.put("Member", m.getSocketAddress().toString() + " [" + m.getUuid() + "]"); return JMXUtils.mapToComposite("Counters", "Description", result); }
@Override public String call() { hz.getCountDownLatch("latch").countDown(); return hz.getCluster().getLocalMember().toString() + ":" + input; }
public PartitionServiceBeanDTO(InternalPartitionService partitionService, HazelcastInstanceImpl hazelcastInstance) { Address address = hazelcastInstance.getCluster().getLocalMember().getAddress(); this.partitionCount = partitionService.getPartitionCount(); this.activePartitionCount = partitionService.getMemberPartitionsIfAssigned(address).size(); }
public PartitionServiceBeanDTO(InternalPartitionService partitionService, HazelcastInstanceImpl hazelcastInstance) { Address address = hazelcastInstance.getCluster().getLocalMember().getAddress(); this.partitionCount = partitionService.getPartitionCount(); this.activePartitionCount = partitionService.getMemberPartitionsIfAssigned(address).size(); }
public static void main(String[] args) throws Exception { HazelcastInstance instance = Hazelcast.newHazelcastInstance(); IScheduledExecutorService scheduler = instance.getScheduledExecutorService("scheduler"); IScheduledFuture<String> future = scheduler.scheduleOnMember(new EchoTask("My Task"), instance.getCluster().getLocalMember(), 5, TimeUnit.SECONDS); Object result = future.get(); System.out.println("Result: " + result); future.dispose(); Hazelcast.shutdownAll(); } }
@ManagedAnnotation("activePartitionCount") @ManagedDescription("Number of active partitions") public int getActivePartitionCount() { Address thisAddress = hazelcastInstance.getCluster().getLocalMember().getAddress(); return managedObject.getMemberPartitionsIfAssigned(thisAddress).size(); }
@ManagedAnnotation("activePartitionCount") @ManagedDescription("Number of active partitions") public int getActivePartitionCount() { Address thisAddress = hazelcastInstance.getCluster().getLocalMember().getAddress(); return managedObject.getMemberPartitionsIfAssigned(thisAddress).size(); }
private static InetSocketAddress getInetSocketAddress(HazelcastInstance hazelcastInstance) { try { return (InetSocketAddress) hazelcastInstance.getLocalEndpoint().getSocketAddress(); } catch (NoSuchMethodError ignored) { try { return hazelcastInstance.getCluster().getLocalMember().getInetSocketAddress(); } catch (Exception e) { return null; } } }
public HazelcastClusterManager(HazelcastInstance hazelcast) { this.hazelcast = hazelcast; this.nodeId = hazelcast.getCluster().getLocalMember().getUuid(); hazelcast.getCluster().addMembershipListener(this); }
@Test public void test_cluster() { // When run("cluster"); // Then String actual = captureOut(); assertContains(actual, jet.getCluster().getLocalMember().getUuid()); assertContains(actual, "ACTIVE"); }