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; } }
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; }