public void initialize(Config config) { try { this._config = config; this._leaderFinder = getLeaderFinder(this._config); if (this._leaderFinder.isPresent()) { this._leaderFinder.get().startAsync(); this._leaderFinder.get().awaitRunning(100, TimeUnit.SECONDS); } this._injector = createInjector(this._config, this._leaderFinder); } catch (URISyntaxException | IOException | TimeoutException exc) { log.error(String.format("Error in %s initialization.", ThrottlingGuiceServletConfig.class.getSimpleName()), exc); throw new RuntimeException(exc); } }
@Override public void close() { try { if (this._leaderFinder.isPresent()) { this._leaderFinder.get().stopAsync(); this._leaderFinder.get().awaitTerminated(2, TimeUnit.SECONDS); } } catch (TimeoutException te) { // Do nothing } }
if (this.leaderFinderOpt.isPresent() && !this.leaderFinderOpt.get().isLeader()) { URI leaderUri = this.leaderFinderOpt.get().getLeaderMetadata().getUri();
if (this.leaderFinderOpt.isPresent() && !this.leaderFinderOpt.get().isLeader()) { URI leaderUri = this.leaderFinderOpt.get().getLeaderMetadata().getUri();
@Override public void close() { try { if (this._leaderFinder.isPresent()) { this._leaderFinder.get().stopAsync(); this._leaderFinder.get().awaitTerminated(2, TimeUnit.SECONDS); } } catch (TimeoutException te) { // Do nothing } }
public void initialize(Config config) { try { this._config = config; this._leaderFinder = getLeaderFinder(this._config); if (this._leaderFinder.isPresent()) { this._leaderFinder.get().startAsync(); this._leaderFinder.get().awaitRunning(100, TimeUnit.SECONDS); } this._injector = createInjector(this._config, this._leaderFinder); } catch (URISyntaxException | IOException | TimeoutException exc) { log.error(String.format("Error in %s initialization.", ThrottlingGuiceServletConfig.class.getSimpleName()), exc); throw new RuntimeException(exc); } }