コード例 #1
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;
 }
コード例 #2
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;
 }