private void adjustRequestProcessorsPool ( ) { assertLocked ( ) ; AttrRequests attrRequests = cmParams . getRequests ( ) ; int requests = attrRequests != null ? attrRequests . intValue ( ) : 2 ; // NOTE In polling mode with default WAIT=60 connection // will be unresponsive if ( requests <= 1 && "1" . equals ( String . valueOf ( cmParams . getHold ( ) ) ) ) { LOG . warning ( "CM supports only 1 requests at a time and there is" + " a risk of connection being stuck up to " + cmParams . getWait ( ) + "seconds" ) ; } // Expand request processors pool if ( requests > procThreads . length ) { RequestProcessor [ ] oldProcessors = procThreads ; procThreads = new RequestProcessor [ requests ] ; System . arraycopy ( oldProcessors , 0 , procThreads , 0 , oldProcessors . length ) ; for ( int i = oldProcessors . length ; i < requests ; i ++ ) { procThreads [ i ] = new RequestProcessor ( i ) ; procThreads [ i ] . start ( ) ; } } }
Checks the value of REQ attribute received from the CM and adjusts the size of the request processors pool .