@Override public void start(String jobManagerAkkaUrl) throws Exception { LOG.info("Starting with JobManager {} on port {}", jobManagerAkkaUrl, getServerPort()); synchronized (startupShutdownLock) { jobManagerAddressPromise.success(jobManagerAkkaUrl); leaderRetrievalService.start(retriever); long delay = backPressureStatsTracker.getCleanUpInterval(); // Scheduled back pressure stats tracker cache cleanup. We schedule // this here repeatedly, because cache clean up only happens on // interactions with the cache. We need it to make sure that we // don't leak memory after completed jobs or long ago accessed stats. bootstrap .childGroup() .scheduleWithFixedDelay( new Runnable() { @Override public void run() { try { backPressureStatsTracker.cleanUpOperatorStatsCache(); } catch (Throwable t) { LOG.error("Error during back pressure stats cache cleanup.", t); } } }, delay, delay, TimeUnit.MILLISECONDS); } }
@Override public void close() throws IOException { int quietPeriodSecs = mTachyonConf.getInt(Constants.WORKER_NETWORK_NETTY_SHUTDOWN_QUIET_PERIOD); int timeoutSecs = mTachyonConf.getInt(Constants.WORKER_NETWORK_NETTY_SHUTDOWN_TIMEOUT); // TODO(binfan): investigate when timeoutSecs is zero (e.g., set in integration tests), does // this still complete successfully. mChannelFuture.channel().close().awaitUninterruptibly(timeoutSecs, TimeUnit.SECONDS); mBootstrap.group().shutdownGracefully(quietPeriodSecs, timeoutSecs, TimeUnit.SECONDS); mBootstrap.childGroup().shutdownGracefully(quietPeriodSecs, timeoutSecs, TimeUnit.SECONDS); }
@After public void teardown() throws Exception { serverChannel.close().sync(); Future<?> serverGroup = sb.group().shutdownGracefully(0, 0, MILLISECONDS); Future<?> serverChildGroup = sb.childGroup().shutdownGracefully(0, 0, MILLISECONDS); Future<?> clientGroup = cb.group().shutdownGracefully(0, 0, MILLISECONDS); serverGroup.sync(); serverChildGroup.sync(); clientGroup.sync(); }
@After public void teardown() throws Exception { cleanupCapturedRequests(); cleanupCapturedResponses(); serverChannel.close().sync(); Future<?> serverGroup = sb.group().shutdownGracefully(0, 0, TimeUnit.MILLISECONDS); Future<?> serverChildGroup = sb.childGroup().shutdownGracefully(0, 0, TimeUnit.MILLISECONDS); Future<?> clientGroup = cb.group().shutdownGracefully(0, 0, TimeUnit.MILLISECONDS); serverGroup.sync(); serverChildGroup.sync(); clientGroup.sync(); clientDelegator = null; serverDelegator = null; clientChannel = null; serverChannel = null; serverConnectedChannel = null; }
public static void shutdown() { getServer().shutdown(); serverThread.interrupt(); serverBootstrap.childGroup().shutdownGracefully(); serverBootstrap.group().shutdownGracefully(); }