Package com.sun.akuma

Examples of com.sun.akuma.Daemon


    private IndexerSupervisor indexerSupervisor;
    private StateWatchingZooKeeper zk;
    private Server server;

    public static void main(String[] args) {
        Daemon d = new Daemon() {
            @Override
            public void init() throws Exception {
                init("/var/run/hbase-indexer.pid");
            }
        };
        try {
        if(d.isDaemonized()) {
            // perform initialization as a daemon
            // this involves in closing file descriptors, recording PIDs, etc.
            d.init();
        } else {
            // if you are already daemonized, no point in daemonizing yourself again,
            // so do this only when you aren't daemonizing.
            if(args != null && args.length > 0 && "daemon".equals(args[0])) {
                d.daemonize();
                System.exit(0);
            }
        }
        } catch (Exception e) {
            log.error("Error setting up hbase-indexer daemon", e);
View Full Code Here


   */
  @Override
  public int execute(ApplicationDescriptor application, String[] args)
  {
    int result = ResultCode.OK;
    Daemon daemon = new Daemon();

    if (daemon.isDaemonized())
    {
      try
      {
        daemon.init(UnixCommandUtil.getPidFile(application).getAbsolutePath());
        result = executeApplication(application);
      }
      catch (Exception ex)
      {
        logger.log(Level.SEVERE, null, ex);
        System.err.println("could not create daemon");
        result = ResultCode.DAEMON_START;
      }
    }
    else
    {
      try
      {
        daemon.daemonize();
      }
      catch (IOException ex)
      {
        logger.log(Level.SEVERE, null, ex);
        System.err.println("could not create daemon");
View Full Code Here

TOP

Related Classes of com.sun.akuma.Daemon

Copyright © 2018 www.massapicom. 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.