public static InetAddress findConnectingAddress( LeaderRetrievalService leaderRetrievalService, FiniteDuration timeout) throws LeaderRetrievalException { ConnectionUtils.LeaderConnectingAddressListener listener = new ConnectionUtils.LeaderConnectingAddressListener(); try { leaderRetrievalService.start(listener); LOG.info("Trying to select the network interface and address to use " + "by connecting to the leading JobManager."); LOG.info("TaskManager will try to connect for " + timeout + " before falling back to heuristics"); return listener.findConnectingAddress(timeout); } catch (Exception e) { throw new LeaderRetrievalException("Could not find the connecting address by " + "connecting to the current leader.", e); } finally { try { leaderRetrievalService.stop(); } catch (Exception fe) { LOG.warn("Could not stop the leader retrieval service.", fe); } } }
public InetAddress findConnectingAddress( FiniteDuration timeout, FiniteDuration startLoggingAfter) throws LeaderRetrievalException { final long startTimeNanos = System.nanoTime(); long currentSleepTime = MIN_SLEEP_TIME; long elapsedTimeMillis = 0; InetSocketAddress targetAddress = null; try { while (elapsedTimeMillis < timeout.toMillis()) { long maxTimeout = timeout.toMillis() - elapsedTimeMillis; synchronized (retrievalLock) { if (exception != null) { throw exception; } if (retrievalState == LeaderRetrievalState.NOT_RETRIEVED) { try { retrievalLock.wait(maxTimeout); } catch (InterruptedException e) { throw new Exception("Finding connecting address was interrupted" + "while waiting for the leader retrieval."); } } else if (retrievalState == LeaderRetrievalState.NEWLY_RETRIEVED) { targetAddress = AkkaUtils.getInetSockeAddressFromAkkaURL(akkaURL);
public InetAddress findConnectingAddress( FiniteDuration timeout, FiniteDuration startLoggingAfter) throws LeaderRetrievalException { final long startTimeNanos = System.nanoTime(); long currentSleepTime = MIN_SLEEP_TIME; long elapsedTimeMillis = 0; InetSocketAddress targetAddress = null; try { while (elapsedTimeMillis < timeout.toMillis()) { long maxTimeout = timeout.toMillis() - elapsedTimeMillis; synchronized (retrievalLock) { if (exception != null) { throw exception; } if (retrievalState == LeaderRetrievalState.NOT_RETRIEVED) { try { retrievalLock.wait(maxTimeout); } catch (InterruptedException e) { throw new Exception("Finding connecting address was interrupted" + "while waiting for the leader retrieval."); } } else if (retrievalState == LeaderRetrievalState.NEWLY_RETRIEVED) { targetAddress = AkkaUtils.getInetSocketAddressFromAkkaURL(akkaURL);
public InetAddress findConnectingAddress( FiniteDuration timeout, FiniteDuration startLoggingAfter) throws LeaderRetrievalException { final long startTimeNanos = System.nanoTime(); long currentSleepTime = MIN_SLEEP_TIME; long elapsedTimeMillis = 0; InetSocketAddress targetAddress = null; try { while (elapsedTimeMillis < timeout.toMillis()) { long maxTimeout = timeout.toMillis() - elapsedTimeMillis; synchronized (retrievalLock) { if (exception != null) { throw exception; } if (retrievalState == LeaderRetrievalState.NOT_RETRIEVED) { try { retrievalLock.wait(maxTimeout); } catch (InterruptedException e) { throw new Exception("Finding connecting address was interrupted" + "while waiting for the leader retrieval."); } } else if (retrievalState == LeaderRetrievalState.NEWLY_RETRIEVED) { targetAddress = AkkaUtils.getInetSocketAddressFromAkkaURL(akkaURL);
public InetAddress findConnectingAddress( FiniteDuration timeout, FiniteDuration startLoggingAfter) throws LeaderRetrievalException { final long startTimeNanos = System.nanoTime(); long currentSleepTime = MIN_SLEEP_TIME; long elapsedTimeMillis = 0; InetSocketAddress targetAddress = null; try { while (elapsedTimeMillis < timeout.toMillis()) { long maxTimeout = timeout.toMillis() - elapsedTimeMillis; synchronized (retrievalLock) { if (exception != null) { throw exception; } if (retrievalState == LeaderRetrievalState.NOT_RETRIEVED) { try { retrievalLock.wait(maxTimeout); } catch (InterruptedException e) { throw new Exception("Finding connecting address was interrupted" + "while waiting for the leader retrieval."); } } else if (retrievalState == LeaderRetrievalState.NEWLY_RETRIEVED) { targetAddress = AkkaUtils.getInetSocketAddressFromAkkaURL(akkaURL);
public static InetAddress findConnectingAddress( LeaderRetrievalService leaderRetrievalService, FiniteDuration timeout) throws LeaderRetrievalException { ConnectionUtils.LeaderConnectingAddressListener listener = new ConnectionUtils.LeaderConnectingAddressListener(); try { leaderRetrievalService.start(listener); LOG.info("Trying to select the network interface and address to use " + "by connecting to the leading JobManager."); LOG.info("TaskManager will try to connect for " + timeout + " before falling back to heuristics"); return listener.findConnectingAddress(timeout); } catch (Exception e) { throw new LeaderRetrievalException("Could not find the connecting address by " + "connecting to the current leader.", e); } finally { try { leaderRetrievalService.stop(); } catch (Exception fe) { LOG.warn("Could not stop the leader retrieval service.", fe); } } }
public static InetAddress findConnectingAddress( LeaderRetrievalService leaderRetrievalService, FiniteDuration timeout) throws LeaderRetrievalException { ConnectionUtils.LeaderConnectingAddressListener listener = new ConnectionUtils.LeaderConnectingAddressListener(); try { leaderRetrievalService.start(listener); LOG.info("Trying to select the network interface and address to use " + "by connecting to the leading JobManager."); LOG.info("TaskManager will try to connect for " + timeout + " before falling back to heuristics"); return listener.findConnectingAddress(timeout); } catch (Exception e) { throw new LeaderRetrievalException("Could not find the connecting address by " + "connecting to the current leader.", e); } finally { try { leaderRetrievalService.stop(); } catch (Exception fe) { LOG.warn("Could not stop the leader retrieval service.", fe); } } }
public static InetAddress findConnectingAddress( LeaderRetrievalService leaderRetrievalService, FiniteDuration timeout) throws LeaderRetrievalException { ConnectionUtils.LeaderConnectingAddressListener listener = new ConnectionUtils.LeaderConnectingAddressListener(); try { leaderRetrievalService.start(listener); LOG.info("Trying to select the network interface and address to use " + "by connecting to the leading JobManager."); LOG.info("TaskManager will try to connect for " + timeout + " before falling back to heuristics"); return listener.findConnectingAddress(timeout); } catch (Exception e) { throw new LeaderRetrievalException("Could not find the connecting address by " + "connecting to the current leader.", e); } finally { try { leaderRetrievalService.stop(); } catch (Exception fe) { LOG.warn("Could not stop the leader retrieval service.", fe); } } }