@Override public PartitionService getPartitionService() { return delegatedInstance.getPartitionService(); }
private static void waitUntilClusterSafe() throws InterruptedException { while (!clusterB.getPartitionService().isClusterSafe()) { Thread.sleep(100); } }
private static void waitUntilClusterSafe() throws InterruptedException { while (!clusterA.getPartitionService().isClusterSafe()) { Thread.sleep(100); } }
public static void main(String[] args) { HazelcastInstance node = Hazelcast.newHazelcastInstance(); boolean safe = node.getPartitionService().isLocalMemberSafe(); System.out.printf("# Is local member safe for shutdown\t: %s\n", safe); } }
public static void main(String[] args) { HazelcastInstance node = Hazelcast.newHazelcastInstance(); boolean safe = node.getPartitionService().isClusterSafe(); System.out.printf("# Is cluster safe for shutdown\t: %s\n", safe); } }
@Setup public void setUp() { this.partitionService = targetInstance.getPartitionService(); this.map = targetInstance.getMap(name); }
@Override public Boolean call() throws Exception { boolean safe = node.getPartitionService().forceLocalMemberToBeSafe(5, TimeUnit.SECONDS); return safe; }
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); } }
private void waitUntilClusterSafe() { while (!clusterA.getPartitionService().isClusterSafe()) { sleepMillis(100); } }
private static void waitUntilClusterSafe() { while (!clusterA.getPartitionService().isClusterSafe()) { sleepMillis(100); } }
private static void waitUntilClusterSafe() { while (!clusterB.getPartitionService().isClusterSafe()) { sleepMillis(100); } }
private void waitUntilClusterSafe() { while (!clusterB.getPartitionService().isClusterSafe()) { sleepMillis(100); } }
private static boolean isLocalKey(HazelcastInstance instance, String key) { PartitionService partitionService = instance.getPartitionService(); Partition partition = partitionService.getPartition(key); Member owner = partition.getOwner(); return owner.equals(instance.getLocalEndpoint()); }
@Override public void init(@Nonnull Context context) { addrToPartitions = context.jetInstance().getHazelcastInstance().getPartitionService().getPartitions() .stream() .collect(groupingBy(p -> p.getOwner().getAddress(), mapping(Partition::getPartitionId, toList()))); }
@Override public void init(@Nonnull Context context) { if (clientXml != null) { initRemote(); } else { initLocal(context.jetInstance().getHazelcastInstance().getPartitionService().getPartitions()); } }
private String getServiceInfo(DistributedObject obj) { final Partition partition = instance.getPartitionService().getPartition(obj.getPartitionKey()); return String.format("serviceName=%s, partitionId=%d, owner=%s", obj.getServiceName(), partition.getPartitionId(), partition.getOwner()); }
@Override public void init(@Nonnull Context context) { if (context.localParallelism() != 1) { throw new IllegalArgumentException( "Non-distributed vertex had parallelism of " + context.localParallelism() + ", should be 1"); } String key = StringPartitioningStrategy.getPartitionKey(partitionKey); ownerAddress = context.jetInstance().getHazelcastInstance().getPartitionService() .getPartition(key).getOwner().getAddress(); }
private MapConfig convertAndStoreMapConfig(String mapName, CacheSettings newSettings, Config config, MapConfig baseConfig) { MapConfig newConfig = new MapConfig(baseConfig); newConfig.setName(mapName); newConfig.setStatisticsEnabled(true); new HazelcastMapConfigConfigurator().configureMapConfig(newSettings, newConfig, hazelcast.getPartitionService().getPartitions().size()); config.addMapConfig(newConfig); return newConfig; }
@SuppressWarnings("checkstyle:magicnumber") @SuppressFBWarnings({"EI_EXPOSE_REP2"}) public ExpirationManager(ClearExpiredRecordsTask task, NodeEngine nodeEngine) { this.task = task; this.nodeEngine = nodeEngine; this.globalTaskScheduler = nodeEngine.getExecutionService().getGlobalTaskScheduler(); this.taskPeriodSeconds = checkPositive(task.getTaskPeriodSeconds(), "taskPeriodSeconds should be a positive number"); this.lifecycleService = getHazelcastInstance().getLifecycleService(); this.lifecycleListenerId = lifecycleService.addLifecycleListener(this); this.partitionService = getHazelcastInstance().getPartitionService(); this.partitionLostListenerId = partitionService.addPartitionLostListener(this); }
@Override public void onStart() { logger.info("Plugin:active: logPartitions:" + logPartitions); connectionObservable.addConnectionListener(new ConnectionListenerImpl()); hazelcastInstance.getCluster().addMembershipListener(new MembershipListenerImpl()); if (logPartitions) { hazelcastInstance.getPartitionService().addMigrationListener(new MigrationListenerImpl()); } hazelcastInstance.getLifecycleService().addLifecycleListener(new LifecycleListenerImpl()); if (nodeExtension != null) { nodeExtension.registerListener(new ClusterVersionListenerImpl()); } }