コード例 #1
0
 private Object executeTaskAndGet(final DistributedTask task) {
   try {
     factory.getExecutorService().execute(task);
     try {
       return task.get(3, TimeUnit.SECONDS);
     } catch (Throwable e) {
       logger.log(Level.FINEST, e.getMessage(), e);
       return null;
     }
   } catch (Throwable e) {
     if (running.get() && factory.node.isActive()) {
       logger.log(Level.WARNING, e.getMessage(), e);
     }
     return null;
   }
 }
コード例 #2
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;
 }