Examples of Alarm


Examples of com.caucho.util.Alarm

  public void destroy()
  {
    _dataSource = null;
    _freeConn = null;

    Alarm alarm = _alarm;
    _alarm = null;

    if (alarm != null)
      alarm.dequeue();
  }
View Full Code Here

Examples of com.caucho.util.Alarm

  {
    _cdiManager = InjectManager.create();
   
    _hostContainer = new HostContainer(this);

    _alarm = new Alarm(this);
   
    _bamService = BamSystem.getCurrent();

    _authManager = new ServerAuthManager();
    // XXX:
View Full Code Here

Examples of com.caucho.util.Alarm

      // getInvocationServer().stop();
      // notify other servers that we've stopped
      notifyStop();

      Alarm alarm = _alarm;
      _alarm = null;

      if (alarm != null)
        alarm.dequeue();

      try {
        if (_systemStore != null)
          _systemStore.close();
      } catch (Throwable e) {
View Full Code Here

Examples of com.caucho.util.Alarm

      throw ConfigException.create(e);
    }

    super.init();

    _alarm = new Alarm("rewrite-dispatch-import", this, _dependencyCheckInterval);
  }
View Full Code Here

Examples of com.caucho.util.Alarm

  public void destroy()
  {
    try {
      _isDestroyed = true;

      Alarm alarm = _alarm;
      _alarm = null;

      MatchRule matchRule = _matchRule;
      _matchRule = null;

      if (alarm != null)
        alarm.dequeue();

      if (matchRule != null)
        matchRule.destroy();

    }
View Full Code Here

Examples of com.caucho.util.Alarm

    initDatabase();

    _serverVersion = initVersion();
    _startupLastUpdateTime = initLastUpdateTime();

    _alarm = new Alarm(this);
    handleAlarm(_alarm);
  }
View Full Code Here

Examples of com.caucho.util.Alarm

    return 0;
  }

  public void close()
  {
    Alarm alarm = _alarm;
    _alarm = null;

    if (alarm != null)
      alarm.close();
  }
View Full Code Here

Examples of com.caucho.util.Alarm

  public void destroy()
  {
    _dataSource = null;
    _freeConn = null;

    Alarm alarm = _alarm;
    _alarm = null;

    if (alarm != null)
      alarm.dequeue();
  }
View Full Code Here

Examples of com.caucho.util.Alarm

    }

    if (_sessions == null)
      return;

    Alarm alarm = _alarm;
    _alarm = null;

    if (alarm != null)
      alarm.dequeue();

    ArrayList<SessionImpl> list = new ArrayList<SessionImpl>();

    // XXX: messy way of dealing with saveOnlyOnShutdown
    synchronized (_sessions) {
View Full Code Here

Examples of com.caucho.util.Alarm

        log.finer("[cgi] exec " + args[0]);
    }

    Runtime runtime = Runtime.getRuntime();
    Process process = null;
    Alarm alarm = null;

    try {
      File dir = new File(Vfs.lookup(realPath).getParent().getNativePath());

      if (log.isLoggable(Level.FINE)) {
        CharBuffer argsBuf = new CharBuffer();

        argsBuf.append('[');

        for (String arg : args) {
          if (argsBuf.length() > 1)
            argsBuf.append(", ");

          argsBuf.append('"');
          argsBuf.append(arg);
          argsBuf.append('"');
        }

        argsBuf.append(']');

        log.fine(L.l("exec {0} (pwd={1})", argsBuf, dir));

        if (log.isLoggable(Level.FINEST)) {
          for (String envElement : env)
            log.finest(envElement);
        }
      }

      process = runtime.exec(args, env, dir);

      InputStream inputStream = process.getInputStream();
      InputStream errorStream = process.getErrorStream();

      TimeoutAlarm timeout;
      timeout = new TimeoutAlarm(requestURI, process, inputStream);
      alarm = new Alarm(timeout, 360 * 1000);

      OutputStream outputStream = process.getOutputStream();

      TempBuffer tempBuf = TempBuffer.allocate();
      byte []buf = tempBuf.getBuffer();
     
      try {
        ServletInputStream sis = req.getInputStream();
        int len;

        while ((len = sis.read(buf, 0, buf.length)) > 0) {
          outputStream.write(buf, 0, len);
        }

        outputStream.flush();
      } catch (IOException e) {
        log.log(Level.FINER, e.toString(), e);
      } finally {
        outputStream.close();
      }
     
      TempBuffer.free(tempBuf);
      tempBuf = null;

      ReadStream rs = Vfs.openRead(inputStream);
      boolean hasStatus = false;

      try {
        hasStatus = parseHeaders(req, res, rs);

        OutputStream out = res.getOutputStream();

        rs.writeToStream(out);
      } finally {
        try {
          rs.close();
        } catch (Throwable e) {
          log.log(Level.FINER, e.toString(), e);

        }

        inputStream.close();
      }

      StringBuilder error = new StringBuilder();
      boolean hasContent = false;
      int ch;

      while (errorStream.available() > 0 && (ch = errorStream.read()) > 0) {
        error.append((char) ch);

        if (! Character.isWhitespace((char) ch))
          hasContent = true;
      }
      errorStream.close();

      if (hasContent) {
        String errorString = error.toString();

        log.warning(errorString);

        if (! hasStatus && _stderrIsException)
          throw new ServletException(errorString);
      }

      int exitCode = process.waitFor();

      if (exitCode != 0) {
        if (hasStatus) {
          if (log.isLoggable(Level.FINER))
            log.finer(L.l("exit code {0} (ignored, hasStatus)", exitCode));
        }
        else if (_ignoreExitCode) {
          if (log.isLoggable(Level.FINER))
            log.finer(L.l("exit code {0} (ignored)", exitCode));
        }
        else
          throw new ServletException(L.l("CGI execution failed.  Exit code {0}",
                                         exitCode));
      }
    } catch (IOException e) {
      throw e;
    } catch (ServletException e) {
      throw e;
    } catch (Exception e) {
      throw new ServletException(e);
    } finally {
      if (alarm != null)
        alarm.dequeue();

      try {
        process.destroy();
      } catch (Throwable e) {
      }
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.