Package org.apache.storm.utils
Class JCQueue
java.lang.Object
org.apache.storm.utils.JCQueue
- All Implemented Interfaces:
- Closeable,- AutoCloseable
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic interfacestatic interface
- 
Constructor SummaryConstructorsConstructorDescriptionJCQueue(String queueName, String metricNamePrefix, int size, int overflowLimit, int producerBatchSz, IWaitStrategy backPressureWaitStrategy, String topologyId, String componentId, List<Integer> taskIds, int port, StormMetricRegistry metricRegistry) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()intconsume(JCQueue.Consumer consumer) Non blocking.intconsume(JCQueue.Consumer consumer, JCQueue.ExitCondition exitCond) Non blocking.voidflush()if(batchSz>1) : Blocking call.intintdoublebooleanvoidBlocking call.voidintsize()booleantryFlush()if(batchSz>1) : Non-Blocking call.booleantryPublish(Object obj) Non-blocking call, returns false if full.booleantryPublishDirect(Object obj) Non-blocking call.booleanUn-batched write to overflowQ.
- 
Constructor Details- 
JCQueuepublic JCQueue(String queueName, String metricNamePrefix, int size, int overflowLimit, int producerBatchSz, IWaitStrategy backPressureWaitStrategy, String topologyId, String componentId, List<Integer> taskIds, int port, StormMetricRegistry metricRegistry) 
 
- 
- 
Method Details- 
getQueueName
- 
closepublic void close()- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
 
- 
consumeNon blocking. Returns immediately if Q is empty. Returns number of elements consumed from Q.
- 
consumeNon blocking. Returns immediately if Q is empty. Runs till Q is empty OR exitCond.keepRunning() return false. Returns number of elements consumed from Q.
- 
sizepublic int size()
- 
getQueueLoadpublic double getQueueLoad()
- 
publishBlocking call. Retries till it can successfully publish the obj. Can be interrupted via Thread.interrupt().- Throws:
- InterruptedException
 
- 
tryPublishNon-blocking call, returns false if full.
- 
tryPublishDirectNon-blocking call. Bypasses any batching that may be enabled on the recvQueue. Intended for sending flush/metrics tuples
- 
tryPublishToOverflowUn-batched write to overflowQ. Should only be called by WorkerTransfer returns false if overflowLimit has reached
- 
recordMsgDroppublic void recordMsgDrop()
- 
isEmptyOverflowpublic boolean isEmptyOverflow()
- 
getOverflowCountpublic int getOverflowCount()
- 
getQueuedCountpublic int getQueuedCount()
- 
flushif(batchSz>1) : Blocking call. Does not return until at least 1 element is drained or Thread.interrupt() is received if(batchSz==1) : NO-OP. Returns immediately. doesnt throw.- Throws:
- InterruptedException
 
- 
tryFlushpublic boolean tryFlush()if(batchSz>1) : Non-Blocking call. Tries to flush as many as it can. Returns true if flushed at least 1. if(batchSz==1) : This is a NO-OP. Returns true immediately.
 
-