コード例 #1
0
 Object call(Address address, Callable callable) {
   Set<Member> members = factory.getCluster().getMembers();
   for (Member member : members) {
     if (address.equals(((MemberImpl) member).getAddress())) {
       DistributedTask task = new DistributedTask(callable, member);
       return executeTaskAndGet(task);
     }
   }
   return null;
 }
コード例 #2
0
 Collection callOnMembers(Set<Address> addresses, Callable callable) {
   Set<Member> allMembers = factory.getCluster().getMembers();
   Set<Member> selectedMembers = new HashSet<Member>(addresses.size());
   for (Member member : allMembers) {
     if (addresses.contains(((MemberImpl) member).getAddress())) {
       selectedMembers.add(member);
     }
   }
   return callOnMembers0(selectedMembers, callable);
 }
コード例 #3
0
 public byte[] changeWebServerUrlOverCluster(String groupName, String groupPass, String newUrl) {
   try {
     GroupConfig groupConfig = factory.getConfig().getGroupConfig();
     if (!(groupConfig.getName().equals(groupName) && groupConfig.getPassword().equals(groupPass)))
       return HttpCommand.RES_403;
     ManagementCenterConfigCallable callable = new ManagementCenterConfigCallable(newUrl);
     callable.setHazelcastInstance(factory);
     Set<Member> members = factory.getCluster().getMembers();
     MultiTask<Void> task = new MultiTask<Void>(callable, members);
     ExecutorService executorService = factory.getExecutorService();
     executorService.execute(task);
   } catch (Throwable throwable) {
     logger.log(Level.WARNING, "New web server url cannot be assigned.", throwable);
     return HttpCommand.RES_500;
   }
   return HttpCommand.RES_204;
 }
コード例 #4
0
 public TimedMemberState getTimedMemberState() {
   if (running.get()) {
     final MemberStateImpl memberState = new MemberStateImpl();
     createMemberState(memberState);
     GroupConfig groupConfig = factory.getConfig().getGroupConfig();
     TimedMemberState timedMemberState = new TimedMemberState();
     timedMemberState.setMaster(factory.node.isMaster());
     if (timedMemberState.getMaster()) {
       timedMemberState.setMemberList(new ArrayList<String>());
       Set<Member> memberSet = factory.getCluster().getMembers();
       for (Member member : memberSet) {
         MemberImpl memberImpl = (MemberImpl) member;
         Address address = memberImpl.getAddress();
         timedMemberState.getMemberList().add(address.getHost() + ":" + address.getPort());
       }
     }
     timedMemberState.setMemberState(memberState);
     timedMemberState.setClusterName(groupConfig.getName());
     timedMemberState.setInstanceNames(getLongInstanceNames());
     return timedMemberState;
   }
   return null;
 }
コード例 #5
0
 Collection callOnAllMembers(Callable callable) {
   Set<Member> members = factory.getCluster().getMembers();
   return callOnMembers0(members, callable);
 }