Methods Summary |
---|
void | consume()
int noOfQueues = consumerQ.size ();
numOfQueuesProcessed += noOfQueues;
if (traceOn){
logger.log(Level.INFO, "Callflow: ConsumerQProcessor.consume. "+
"ConsumerQ.length ="+ noOfQueues + ". Total number of " +
" Q's Processed = "+ numOfQueuesProcessed);
}
for (int i = 0; i<noOfQueues; i++){
CallflowProducerQueue q = (CallflowProducerQueue) consumerQ.poll();
if (q != null){
if (traceOn){
logger.log(Level.INFO, "Callflow: ConsumerQProcessor.processProducerQ "+
q.getName());
}
TransferObject[] to = q.getAndRemoveAll();
if (to != null){
Handler[] handler = chain.getHandlers();
for (int j=0;j<handler.length;j++ ){
if (traceOn){
logger.log(Level.INFO, "Callflow: ConsumerQProcessor.processProducerQ "+
handler[j]);
}
handler[j].handle(to);
}
}
}
}
|
public java.lang.String | getCONSUMER_SLEEP_TIME()
return CONSUMER_SLEEP_TIME;
|
public long | getNumOfQueuesProcessed()
return numOfQueuesProcessed;
|
public long | getNumOfTimesQSlept()
return numOfTimesQSlept;
|
public int | getSleepTime()consumes the ConsumerQ. Returns the number of Q's processed
return sleepTime;
|
public void | run()
if (traceOn)
logger.log(Level.INFO, "Callflow: ConsumerQProcessor.entering run ");
while (processQ){
if(!consumerQ.isEmpty()){
consume ();
} else{
try {
if (traceOn){
logger.log(Level.INFO, "Callflow: ConsumerQProcessor." +
"Q Empty, sleeping for "+ getSleepTime () +
" ms. Sleeping for the "+getNumOfTimesQSlept()
+ " th time.");
}
this.numOfTimesQSlept++;
Thread.sleep(getSleepTime());
} catch (InterruptedException e){
if (processQ == false){
// do not quit abruptly. Process any items remaining in
// queues before quitting.
if (traceOn)
logger.log(Level.INFO, "Callflow: ConsumerQProcessor." +
"Disable Called, forcing consumption");
break;
}
}
}
}
// force consumption
consume();
if (traceOn){
logger.log(Level.INFO, "Callflow: ConsumerQProcessor.exiting run. "+
" Num of Entries Processed for each table \n"+
this.dbAccessObject.getNumOfRequestsProcessedAsString()
+" \n");
}
|
public void | setSleepTime(int sleepTime)
this.sleepTime = sleepTime;
|
public void | stopConsumerThread()
processQ = false;
if (traceOn){
logger.log (Level.INFO, "Callflow: ConsumerQProcessor.stopConsumerThread ");
}
|