Examples of ShutdownManager


Examples of ariba.util.shutdown.ShutdownManager

    ////////////////////////////////////

    public void initiateShutdown ()
    {
        Log.aribaweb_shutdown.debug("Shutdown request received.  Refusing new sessions.");
        ShutdownManager sm = ShutdownManager.get();
        AWShutdownState.init(sm);
        AWMonitorStats monitorStats = monitorStats();
        setRefusingNewSessions(true);
        monitorStats.setGracefulShutdown(true);
        monitorStats.setRemainingShutdownPeriod(sm.getTimeBeforeShutdown());
    }
View Full Code Here

Examples of com.google.dataconnector.util.ShutdownManager

        this.frameReceiver = new FrameReceiver();
        this.frameReceiver.setInputStream(getInputStream());
        this.calls = new ConcurrentHashMap<String, SdcClientCall>();

        BlockingQueue<FrameInfo> sendQueue = new LinkedBlockingQueue<SdcFrame.FrameInfo>();
        ShutdownManager shutdownManager = new ShutdownManager();
        this.frameSender = new FrameSender(sendQueue, shutdownManager);
        this.frameSender.setOutputStream(getOutputStream());
    }
View Full Code Here

Examples of com.google.dataconnector.util.ShutdownManager

  public static void main(final String[] args) {
    // Bootstrap logging system
    PropertyConfigurator.configure(getBootstrapLoggingProperties());

    final Injector injector = ClientGuiceModule.getInjector();
    final ShutdownManager shutdownManager = injector.getInstance(ShutdownManager.class);
    // Add shutdown hook to call shutdown if control c or OS SIGTERM is received.
    Runtime.getRuntime().addShutdownHook(new Thread() {
      @Override
      public void run() {
        shutdownManager.shutdownAll();
      }
    });

    // Starts the client in a loop that exponentially backs off.
    while (true) {
      try {
        // Only try to back-off if we have unsuccessful connections.
        if (unsuccessfulAttempts > 0) {
          long backOffTime = (long) Math.min(
              MAX_BACKOFF_TIME, Math.pow(2, unsuccessfulAttempts) * 1000L);
          try {
            // Sleep for the amount of time needed.
            Thread.sleep(backOffTime);
          } catch (InterruptedException e) {
            LOG.error("Interrupted while trying to exponentially back off. Exiting.");
            break;
          }
          LOG.info("Starting agent after " + unsuccessfulAttempts + " unsuccessful attempts." +
              " Next connect in " + backOffTime + " milliseconds.");
        } else if (unsuccessfulAttempts == -1) {
          // We are being told to quit probably because we were only configured to start once.
          break;
        }
        injector.getInstance(Client.class).parseFlagsValidateAndConnect(args);
      } catch (Exception e) { // This is an outside server loop. Catch everything.
        LOG.error("Agent died.", e);
        shutdownManager.shutdownAll();
      }
    }
  }
View Full Code Here

Examples of com.tinkerpop.rexster.server.ShutdownManager

            logger.warn("Error while shutting down graphs.  All graphs may not have been shutdown cleanly.");
        }
    }

    private void startShutdownManager(final RexsterProperties properties) throws Exception {
        final ShutdownManager shutdownManager = new ShutdownManager(properties);

        //Register a shutdown hook
        shutdownManager.registerShutdownListener(new ShutdownManager.ShutdownListener() {
            public void shutdown() {
            // shutdown grizzly/graphs
            stop();
            }
        });

        //Start the shutdown listener
        shutdownManager.start();

        //Wait for a shutdown request and all shutdown listeners to complete
        shutdownManager.waitForShutdown();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.