コード例 #1
0
 private void createMemberState(MemberStateImpl memberState) {
   final Node node = factory.node;
   memberState.setAddress(node.getThisAddress());
   memberState.getMemberHealthStats().setOutOfMemory(node.isOutOfMemory());
   memberState.getMemberHealthStats().setActive(node.isActive());
   memberState
       .getMemberHealthStats()
       .setServiceThreadStats(node.getCpuUtilization().serviceThread);
   memberState.getMemberHealthStats().setOutThreadStats(node.getCpuUtilization().outThread);
   memberState.getMemberHealthStats().setInThreadStats(node.getCpuUtilization().inThread);
   PartitionService partitionService = factory.getPartitionService();
   Set<Partition> partitions = partitionService.getPartitions();
   memberState.clearPartitions();
   for (Partition partition : partitions) {
     if (partition.getOwner() != null && partition.getOwner().localMember()) {
       memberState.addPartition(partition.getPartitionId());
     }
   }
   Collection<HazelcastInstanceAwareInstance> proxyObjects =
       new ArrayList<HazelcastInstanceAwareInstance>(factory.getProxies());
   createMemState(memberState, proxyObjects.iterator(), InstanceType.MAP);
   createMemState(memberState, proxyObjects.iterator(), InstanceType.QUEUE);
   createMemState(memberState, proxyObjects.iterator(), InstanceType.TOPIC);
   createRuntimeProps(memberState);
   // uncomment when client changes are made
   // createMemState(memberState, proxyObjects.iterator(), InstanceType.ATOMIC_LONG);
   // createMemState(memberState, proxyObjects.iterator(), InstanceType.COUNT_DOWN_LATCH);
   // createMemState(memberState, proxyObjects.iterator(), InstanceType.SEMAPHORE);
 }
 private static void load(boolean load, ExecutorService es, final MultiMap<String, byte[]> map) {
   if (load) {
     final Member thisMember = Hazelcast.getCluster().getLocalMember();
     for (int i = 0; i < ENTRY_COUNT; i++) {
       final String key = String.valueOf(i);
       Partition partition = Hazelcast.getPartitionService().getPartition(key);
       if (thisMember.equals(partition.getOwner())) {
         es.execute(
             new Runnable() {
               public void run() {
                 map.put(key, new byte[VALUE_SIZE]);
               }
             });
       }
     }
   }
 }