public class JCQueue extends Object implements Closeable
Modifier and Type | Class and Description |
---|---|
static interface |
JCQueue.Consumer |
static interface |
JCQueue.ExitCondition |
Constructor and Description |
---|
JCQueue(String queueName,
String metricNamePrefix,
int size,
int overflowLimit,
int producerBatchSz,
IWaitStrategy backPressureWaitStrategy,
String topologyId,
String componentId,
List<Integer> taskIds,
int port,
StormMetricRegistry metricRegistry) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
int |
consume(JCQueue.Consumer consumer)
Non blocking.
|
int |
consume(JCQueue.Consumer consumer,
JCQueue.ExitCondition exitCond)
Non blocking.
|
void |
flush()
if(batchSz>1) : Blocking call.
|
int |
getOverflowCount() |
int |
getQueuedCount() |
double |
getQueueLoad() |
String |
getQueueName() |
boolean |
isEmptyOverflow() |
void |
publish(Object obj)
Blocking call.
|
void |
recordMsgDrop() |
int |
size() |
boolean |
tryFlush()
if(batchSz>1) : Non-Blocking call.
|
boolean |
tryPublish(Object obj)
Non-blocking call, returns false if full.
|
boolean |
tryPublishDirect(Object obj)
Non-blocking call.
|
boolean |
tryPublishToOverflow(Object obj)
Un-batched write to overflowQ.
|
public JCQueue(String queueName, String metricNamePrefix, int size, int overflowLimit, int producerBatchSz, IWaitStrategy backPressureWaitStrategy, String topologyId, String componentId, List<Integer> taskIds, int port, StormMetricRegistry metricRegistry)
public String getQueueName()
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public int consume(JCQueue.Consumer consumer)
Non blocking. Returns immediately if Q is empty. Returns number of elements consumed from Q.
public int consume(JCQueue.Consumer consumer, JCQueue.ExitCondition exitCond)
Non blocking. Returns immediately if Q is empty. Runs till Q is empty OR exitCond.keepRunning() return false. Returns number of elements consumed from Q.
public int size()
public double getQueueLoad()
public void publish(Object obj) throws InterruptedException
Blocking call. Retries till it can successfully publish the obj. Can be interrupted via Thread.interrupt().
InterruptedException
public boolean tryPublish(Object obj)
Non-blocking call, returns false if full.
public boolean tryPublishDirect(Object obj)
Non-blocking call. Bypasses any batching that may be enabled on the recvQueue. Intended for sending flush/metrics tuples
public boolean tryPublishToOverflow(Object obj)
Un-batched write to overflowQ. Should only be called by WorkerTransfer returns false if overflowLimit has reached
public void recordMsgDrop()
public boolean isEmptyOverflow()
public int getOverflowCount()
public int getQueuedCount()
public void flush() throws InterruptedException
InterruptedException
public 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.
Copyright © 2022 The Apache Software Foundation. All rights reserved.