- ListenableFuture<List<Boolean>> result = SettableFuture.create();
- try {
- List<ListenableFuture<Boolean>> shutdownChain = new ArrayList<>();
- for (ServerFacade server : serverLot) {
- ListenableFuture<Boolean> shutdownFuture = server.shutdown();
- shutdownChain.add(shutdownFuture);
- }
- if (!shutdownChain.isEmpty()) {
- result = Futures.allAsList(shutdownChain);
- } else {
- throw new IllegalStateException("No servers configured");
- }
- } catch (Exception e) {
- SettableFuture<List<Boolean>> exFuture = SettableFuture.create();
- exFuture.setException(e);
- result = exFuture;
- }
+ //TODO: provide exception in case of: not started, not configured (already stopped)
+ ListenableFuture<Boolean> result = serverFacade.shutdown();