You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Schubert Zhang (JIRA)" <ji...@apache.org> on 2013/10/29 06:46:30 UTC

[jira] [Created] (THRIFT-2244) TThreadPoolServer: failureCount and rejections should be out of and before while loop

Schubert Zhang created THRIFT-2244:
--------------------------------------

             Summary: TThreadPoolServer: failureCount and rejections should be out of and before while loop
                 Key: THRIFT-2244
                 URL: https://issues.apache.org/jira/browse/THRIFT-2244
             Project: Thrift
          Issue Type: Bug
          Components: Java - Library
    Affects Versions: 0.9.1
            Reporter: Schubert Zhang
            Priority: Trivial


TThreadPoolServer.server(): failureCount and rejections should be out of and before while loop.

while (!stopped_) {
      int failureCount = 0;
      try {
        TTransport client = serverTransport_.accept();
        WorkerProcess wp = new WorkerProcess(client);
        while(true) {
          int rejections = 0;
          try {
            executorService_.execute(wp);
            break;
          } catch(RejectedExecutionException ex) {
            LOGGER.warn("ExecutorService rejected client " + (++rejections) +
                " times(s)", ex);
            try {
              TimeUnit.SECONDS.sleep(1);
            } catch (InterruptedException e) {
              LOGGER.warn("Interrupted while waiting to place client on" +
              		" executor queue.");
              Thread.currentThread().interrupt();
              break;
            }
          }
        }
      } catch (TTransportException ttx) {
        if (!stopped_) {
          ++failureCount;
          LOGGER.warn("Transport error occurred during acceptance of message.", ttx);
        }
      }
    }



--
This message was sent by Atlassian JIRA
(v6.1#6144)