Package com.caucho.env.thread

Examples of com.caucho.env.thread.ThreadPool


      } finally {
        thread.setContextClassLoader(oldLoader);
        _thread = null;
        _isDone = true;

        ThreadPool threadPool = _threadPool;
       
        if (threadPool != null)
          threadPool.completeExecutorTask();

        // alarm

        removeFuture(this);
View Full Code Here


        && _threadExecutorTaskMax > 0
        && _threadMax < _threadExecutorTaskMax)
      throw new ConfigException(L.l("<thread-executor-task-max> ({0}) must be less than <thread-max> ({1})",
                                    _threadExecutorTaskMax, _threadMax));

    ThreadPool threadPool = ThreadPool.getThreadPool();

    if (_threadMax > 0)
      threadPool.setThreadMax(_threadMax);

    if (_threadIdleMin > 0)
      threadPool.setIdleMin(_threadIdleMin);
   
    if (_threadIdleTimeout > 0)
      threadPool.setIdleTimeout(_threadIdleTimeout);

    threadPool.setExecutorTaskMax(_threadExecutorTaskMax);
   
    /*
    if (_keepaliveSelectEnable) {
      try {
        Class<?> cl = Class.forName("com.caucho.server.connection.JniSelectManager");
View Full Code Here

   * Start a request connection from the idle state.
   */
  void requestAccept()
  {
    if (_requestStateRef.get().toAccept(_requestStateRef)) {
      ThreadPool threadPool = _listener.getThreadPool();
   
      SocketLinkThreadLauncher launcher = _listener.getLauncher();
     
      if (log.isLoggable(Level.FINER)) {
        log.finer(this + " request-accept " + getName()
                  + " (count=" + _listener.getThreadCount()
                  + ", idle=" + _listener.getIdleThreadCount() + ")");
      }
     
     
      boolean isValid = false;
     
      launcher.onChildIdleBegin();
      try {
        if (threadPool.start(getAcceptTask())) {
          isValid = true;
        }
        else {
          log.severe(L.l("Start failed for {0}", this));
        }
View Full Code Here

   * Wake a connection from a select/poll keepalive.
   */
  void requestWakeKeepalive()
  {
    if (_requestStateRef.get().toWakeKeepalive(_requestStateRef)) {
      ThreadPool threadPool = _listener.getThreadPool();
     
      if (! threadPool.schedule(getKeepaliveTask())) {
        log.severe(L.l("Schedule failed for {0}", this));
      }
    }
  }
View Full Code Here

   * Wake a connection from a select/poll keepalive.
   */
  void requestTimeoutKeepalive()
  {
    if (_requestStateRef.get().toWakeKeepalive(_requestStateRef)) {
      ThreadPool threadPool = _listener.getThreadPool();
   
      if (! threadPool.schedule(getKeepaliveTimeoutTask())) {
        log.severe(L.l("Schedule failed for {0}", this));
      }
    }
  }
View Full Code Here

   * Wake a connection from a comet suspend.
   */
  void requestWakeComet()
  {
    if (_requestStateRef.get().toAsyncWake(_requestStateRef)) {
      ThreadPool threadPool = _listener.getThreadPool();
   
      if (! threadPool.schedule(getResumeTask())) {
        log.severe(L.l("Schedule failed for {0}", this));
      }
    }
  }
View Full Code Here

   * Destroys the connection()
   */
  public final void requestDestroy()
  {
    if (_requestStateRef.get().toDestroy(_requestStateRef)) {
      ThreadPool threadPool = _listener.getThreadPool();
   
      if (! threadPool.schedule(new DestroyTask(this))) {
        destroy();
      }
    }
  }
View Full Code Here

        destroy();
        return;
      }
     
      if (! reqState.toAsyncSuspend(_requestStateRef)) {
        ThreadPool threadPool = _listener.getThreadPool();

        if (! threadPool.schedule(getResumeTask())) {
          log.severe(L.l("Schedule resume failed for {0}", this));
        }
      }
     
      return;
View Full Code Here

  }

  @PostConstruct
  public void init()
  {
    ThreadPool threadPool = ThreadPool.getThreadPool();

    if (_threadMax > 0)
      threadPool.setThreadMax(_threadMax);
    // threadPool.setThreadIdleMax(_threadSpareMin + THREAD_GAP);
   
    if (_threadSpareMin > 0)
      threadPool.setIdleMin(_threadSpareMin);
  }
View Full Code Here

TOP

Related Classes of com.caucho.env.thread.ThreadPool

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.