Methods Summary |
---|
public void | add(TransferObject to)Add a TransferObject to the producerQ. Notifies the consumer if Q is
above threshold percentage. Adds after reaching threshold percentage
are allowed.
producerQ.add(to);
int current = CURRENT_SIZE.incrementAndGet();
if (traceOn){
logger.log(Level.INFO, "Callflow:CallflowProducerQ.add : " + name +
" adding row ; QSize = "+ current +
" ThresholdSize = "+ threshold);
}
if (current >= threshold){
flush();
}
|
private void | calculateThreshold()
threshold = Math.round(THRESHOLD_PERCENTAGE * qSize);
|
public void | flush()Allows flushing the producerQ's. This will be called when callflow is to
be disabled and all collected data needs to be explicitly flushed out.
if (CURRENT_SIZE.get () <=0){
return;
}
boolean notified = NOTIFIED_CONSUMER.get();
if (!notified){
try {
consumerQ.put(this);
NOTIFIED_CONSUMER.set(true);
if (traceOn){
logger.log(Level.INFO, "Callflow: CallflowProducerQ.flush:"
+ name +" notifying ConsumerQ ");
}
} catch (InterruptedException ex) {
}
} else {
if (traceOn){
logger.log(Level.INFO, "Callflow: CallflowProducerQ.flush : "
+ name + " "+ "ConsumerPreviouslyNotified? "+ notified+
" Not renotifying the consumer.");
}
}
|
public TransferObject[] | getAndRemoveAll()Empties the producerQ and returns all the TransferObjects.
int current = CURRENT_SIZE.get();
if (current == 0){
return null;
}
TransferObject[] to = new TransferObject[current];
for (int i=0; i<current; i++){
to[i] = producerQ.poll();
}
long numOfEntries = CURRENT_SIZE.longValue();
CURRENT_SIZE.set(CURRENT_SIZE.get() - current);
NOTIFIED_CONSUMER.set(false);
entriesProcessed.addAndGet(numOfEntries);
if (traceOn){
logger.log(Level.INFO, "Callflow: CallflowProducerQ.getAndRemoveAll:"
+ name + " Old Q Size = "+ current + " New Q Size = "+
CURRENT_SIZE.get() + " Notified ConsumerQ reset to false."+
" Entries Processed so far = "+ entriesProcessed.longValue());
}
return to;
|
public int | getCurrentSize()
return CURRENT_SIZE.intValue();
|
public long | getEntriesProcessed()
return entriesProcessed.longValue();
|
public static com.sun.enterprise.admin.monitor.callflow.CallflowProducerQueue | getInstance(java.util.concurrent.BlockingQueue consumerQ, java.lang.String name, int qSize)
return new CallflowProducerQueue(consumerQ, name, qSize);
|
public java.lang.String | getName()
return name;
|
public int | getQSize()
return this.qSize;
|
public void | setName(java.lang.String name)
this.name = name;
|
public void | setQSize(int size)
this.qSize = size;
calculateThreshold();
|