Package org.rzo.yajsw.wrapper

Examples of org.rzo.yajsw.wrapper.WrappedProcess


        p.setService(service);
      }
    }
    else
    {
      WrappedProcess w = WrappedProcessFactory.createProcess(_config);
      // set service in wrapper so that we may stop the service in case the application terminates and we need to shutdown the wrapper
      w.setService(service);
      w.init();
      wList.add(w);
    }
   
    w = wList.get(0);

     

    // start the applications
    // the wrapper may have to wait longer for the application to come up ->
    // start the application
    // in a separate thread and then check that the wrapper is up after a
    // max timeout
    // but return as soon as possible to the windows service controller
    final long maxStartTime = w.getMaxStartTime();
    final Future future = pool.submit(new Runnable()
    {
      public void run()
      {
        try
        {
          Thread.yield();
          wList.startAll();
        }
        catch (Throwable ex)
        {
          ex.printStackTrace();
          w.getWrapperLogger().info("Win Service: error starting wrapper " + ex.getMessage());
          Runtime.getRuntime().halt(999);
        }
      }
    });
    pool.execute(new Runnable()
    {
      public void run()
      {
        try
        {
          future.get(maxStartTime, TimeUnit.MILLISECONDS);
        }
        catch (Exception ex)
        {
          ex.printStackTrace();
          w.getWrapperLogger().info("Win Service: wrapper did not start within " + maxStartTime + " ms " + ex.getMessage());
          Runtime.getRuntime().halt(999);
        }
      }
    });
    w.getWrapperLogger().info("Win service: before service init");

    // init the service for signaling with services.exe. app will hang
    // here until service is stopped
    service.init();
    // service has terminated -> halt the wrapper jvm
    w.getWrapperLogger().info("Win service: terminated correctly");
    Runtime.getRuntime().halt(0);
  }
View Full Code Here


   * @see org.quartz.Job#execute(org.quartz.JobExecutionContext)
   */
  public void execute(JobExecutionContext context) throws JobExecutionException
  {
    JobDataMap dataMap = context.getJobDetail().getJobDataMap();
    WrappedProcess process = (WrappedProcess) dataMap.get("process");
    process.startByTimer();
  }
View Full Code Here

   * @see org.quartz.Job#execute(org.quartz.JobExecutionContext)
   */
  public void execute(JobExecutionContext context) throws JobExecutionException
  {
    JobDataMap dataMap = context.getJobDetail().getJobDataMap();
    WrappedProcess process = (WrappedProcess) dataMap.get("process");
    process.stop();
  }
View Full Code Here

   * @see org.quartz.Job#execute(org.quartz.JobExecutionContext)
   */
  public void execute(JobExecutionContext context) throws JobExecutionException
  {
    JobDataMap dataMap = context.getJobDetail().getJobDataMap();
    WrappedProcess process = (WrappedProcess) dataMap.get("process");
    process.startByTimer();
  }
View Full Code Here

   * @see org.quartz.Job#execute(org.quartz.JobExecutionContext)
   */
  public void execute(JobExecutionContext context) throws JobExecutionException
  {
    JobDataMap dataMap = context.getJobDetail().getJobDataMap();
    WrappedProcess process = (WrappedProcess) dataMap.get("process");
    process.restartByTimer();
  }
View Full Code Here

   * @see org.quartz.Job#execute(org.quartz.JobExecutionContext)
   */
  public void execute(JobExecutionContext context) throws JobExecutionException
  {
    JobDataMap dataMap = context.getJobDetail().getJobDataMap();
    WrappedProcess process = (WrappedProcess) dataMap.get("process");
    process.stop();
  }
View Full Code Here

   * @see org.quartz.Job#execute(org.quartz.JobExecutionContext)
   */
  public void execute(JobExecutionContext context) throws JobExecutionException
  {
    JobDataMap dataMap = context.getJobDetail().getJobDataMap();
    WrappedProcess process = (WrappedProcess) dataMap.get("process");
    process.startByTimer();
  }
View Full Code Here

      return;
    }
    String[] scriptArgs = config.getStringArray(scriptKey + ".args");

    // get a dummy process but do not start it
    WrappedProcess process = WrappedProcessFactory.createProcess(config);
    process.init();

    Script s = ScriptFactory.createScript(script, "test", process, scriptArgs, null, 0);
    if (s == null)
    {
      System.out.println("error initializing script " + script);
View Full Code Here

  private static void doReconnect()
  {
    prepareProperties();
    Configuration localConf = new MapConfiguration(_properties);
    YajswConfiguration conf = new YajswConfigurationImpl(localConf, true);
    WrappedProcess w = WrappedProcessFactory.createProcess(conf);

    System.out.println("************* RECONNECTING WRAPPER TO PID  " + pid + " ***********************");
    System.out.println();

    if (w.reconnect(pid))
      System.out.println("Connected to PID " + pid);
    else
      System.out.println("NOT connected to PID " + pid);
    _exitOnTerminate = false;

View Full Code Here

TOP

Related Classes of org.rzo.yajsw.wrapper.WrappedProcess

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.