Package org.rzo.yajsw.controller.jvm

Examples of org.rzo.yajsw.controller.jvm.JVMController


    super.init();
    _key = "" + new Random(System.currentTimeMillis()).nextLong();
    _localConfiguration.setProperty("wrapper.key", _key);
    if (_controller == null)
    {
      _controller = new JVMController(this);
      configController();
    }

  }
View Full Code Here


   * @return the string
   */
  private List wrapperOptions()
  {
    ArrayList result = new ArrayList();
    JVMController controller = (JVMController) _controller;

    for (Iterator it = _config.getSystemConfiguration().getKeys("wrapper"); it.hasNext();)
    {
      String key = (String) it.next();
      if (("wrapper.service".equals(key) || "wrapper.console.visible".equals(key)) && _config.getBoolean("wrapper.service", false))
        continue;
      if ("wrapper.config".equals(key))
      {
        result.add(checkValue("-D" + key + "=" + _config.getCachedPath()));
      }
      else
        result.add(checkValue("-D" + key + "=" + _config.getProperty(key).toString()));
    }
    result.add("-Dwrapper.port=" + controller.getPort());
    result.add("-Dwrapper.key=" + controller.getKey());
    result.add("-Dwrapper.teeName=" + _teeName);
    result.add("-Dwrapper.tmpPath=" + _tmpPath);

    String preScript = _config.getString("wrapper.app.pre.script", null);
    if (preScript != null & !"".equals(preScript))
View Full Code Here

  /**
   * Config controller.
   */
  void configController()
  {
    JVMController controller = (JVMController) _controller;

    controller.setLogger(getWrapperLogger());
    controller.setKey(_config.getString("wrapper.key"));
    if (_config.containsKey("wrapper.port"))
    {
      controller.setMinPort(_config.getInt("wrapper.port"));
      controller.setMaxPort(_config.getInt("wrapper.port"));
    }
    else
    {
      controller.setMinPort(_config.getInt("wrapper.port.min", Constants.DEFAULT_PORT));
      controller.setMaxPort(_config.getInt("wrapper.port.max", 65535));
    }

    controller.setStartupTimeout(_config.getInt("wrapper.startup.timeout", DEFAULT_STARTUP_TIMEOUT) * 1000);
    controller.setPingTimeout(_config.getInt("wrapper.ping.timeout", DEFAULT_PING_TIMEOUT) * 1000);
    if (!_initController)
    {
      ControllerListener restartHandler = new ControllerListener()
      {
        public void fire()
        {
          if (_state == STATE_RESTART_STOP || _state == STATE_RESTART || _state == STATE_RESTART_START || _state == STATE_RESTART_WAIT)
            return;
          if (allowRestart() && exitCodeRestart() && !exitCodeShutdown())
          {
            restartInternal();
          }
          else
          {
            if (_debug)
            {
              getWrapperLogger().info("giving up after " + _restartCount + " retries");
            }
            if (_state != STATE_USER_STOP)
              setState(STATE_ABORT);
            if (!_exiting)
              stop();
            setState(STATE_IDLE);

          }

        }

      };
      controller.addListener(JVMController.STATE_STARTUP_TIMEOUT, restartHandler);
      controller.addListener(JVMController.STATE_PING_TIMEOUT, restartHandler);
      controller.addListener(JVMController.STATE_PROCESS_KILLED, restartHandler);

      if (!_config.getBoolean("wrapper.ntservice.autoreport.startup", true))
        if (getService() instanceof WrapperMainServiceWin)
          setServiceStartupListener(new Runnable()
          {

            public void run()
            {
              ((WrapperMainServiceWin) getService()).notifyStartup();
            }

          });

      controller.setServiceStartupListener(_serviceStartupListener);

      controller.init();
      _initController = true;
    }
  }
View Full Code Here

    _osProcess.setTeeName(teeName);
    _osProcess.setTmpPath(tmpPath);
    _osProcess.reconnectStreams();

    if (_controller == null)
      _controller = new JVMController(this);

    JVMController controller = (JVMController) _controller;

    // controller.setDebug(true);
    configController();

    _firstRestartTime = System.currentTimeMillis();

    // controller.setDebug(true);
    controller.start();
    controller.processStarted();
    setState(STATE_RUNNING);

    boolean result = controller.waitFor(_config.getInt("wrapper.ping.timeout", DEFAULT_PING_TIMEOUT) * 1000);
    if (result)
    {
      // wait for stream to be available
      for (int i = 0; i < 5 && _osProcess.getInputStream() == null; i++)
        try
View Full Code Here

   */
  public void requestThreadDump()
  {
    if (_controller != null)
    {
      JVMController controller = (JVMController) _controller;
      controller.requestThreadDump();
    }
  }
View Full Code Here

    }
  }

  void stopController(int timeout)
  {
    JVMController controller = (JVMController) _controller;
    controller.stop(JVMController.STATE_USER_STOP);
  }
View Full Code Here

TOP

Related Classes of org.rzo.yajsw.controller.jvm.JVMController

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.