public interface LocalQCacheOpQueue
LocalQCacheOp
for a specific node Node
.
Each node may have from 1 to n queues. Each queue has a single processing (reading) thread so
LocalQConfig.NUMBER_OF_QUEUES_PER_NODE
i.e. the number of processing threads
for each node.
LocalQConfig.NUMBER_OF_QUEUES_PER_NODE
is the concurrency factor for communicating with a single remote node.
Example: if we have a cluster with 3 nodes (node1, node2, node3) on each node there will be
LocalQConfig.NUMBER_OF_QUEUES_PER_NODE
queues for each of the "other" 2 remote nodes.Modifier and Type | Interface and Description |
---|---|
static class |
LocalQCacheOpQueue.QueueId
Uniquely identifies a queue
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(LocalQCacheOp localQCacheOp)
transactional add of
LocalQCacheOp to the queue;
when operation finished we "guarantee" that the LocalQCacheOp is persisted |
void |
backupQueue(String prefix)
Note: use with caution
This method is mainly designed to handle critical state of the queue storage by backing up the current queue
persistent store and recreating a new one.
|
void |
close()
closes the queue and all resources connected with this queue (like processing thread(s), files);
closing a queue is definitive - it will never be open (i.e.
|
boolean |
hasPermission() |
LocalQCacheOpQueue.QueueId |
id() |
boolean |
isClosed()
Some operations (
add(LocalQCacheOp) , remove() , peek() , peekOrBlock() ) on a
closed queue will throw a IllegalStateException . |
String |
name() |
static int |
nodeQueueNumber(long threadId)
utility method to get the nodeQueueNumber for given thread id
|
static int |
nodeQueueNumberForCurrentThread()
utility method to get the nodeQueueNumber for current thread
|
LocalQCacheOp |
peek()
Allows to see whats on the head of the queue without removing it
|
LocalQCacheOp |
peekOrBlock()
see
peek() but will block when the queue is empty; |
void |
remove()
remove
LocalQCacheOp from head of the queue |
int |
size() |
Long |
usableSpaceInBytes() |
void close()
boolean isClosed()
add(LocalQCacheOp)
, remove()
, peek()
, peekOrBlock()
) on a
closed queue will throw a IllegalStateException
.
This method allows to check if the queue has not been closed.String name()
LocalQCacheOpQueue.QueueId id()
LocalQCacheOpQueue.QueueId
boolean add(LocalQCacheOp localQCacheOp) throws IllegalStateException
LocalQCacheOp
to the queue;
when operation finished we "guarantee" that the LocalQCacheOp
is persistedlocalQCacheOp
- IllegalStateException
- when queue is closed@Nullable LocalQCacheOp peek() throws IllegalStateException
IllegalStateException
- when queue is closed@Nullable LocalQCacheOp peekOrBlock() throws InterruptedException, IllegalStateException
peek()
but will block when the queue is empty;InterruptedException
IllegalStateException
- when queue is closed (when calling this method queue is already closed)static int nodeQueueNumberForCurrentThread()
static int nodeQueueNumber(long threadId)
void remove() throws NoSuchElementException, IllegalStateException
LocalQCacheOp
from head of the queueNoSuchElementException
- when doing a remove on an empty queueIllegalStateException
- when queue is closedint size()
void backupQueue(String prefix) throws IOException
backupQueue(String)
is called between peek()
and remove()
this can cause remove()
to delete a different
LocalQCacheOp
then expected or may throw NoSuchElementException
if the new queue after
backupQueue(String)
is empty.IOException
@Nullable Long usableSpaceInBytes()
boolean hasPermission()
Copyright © 2002-2018 Atlassian. All Rights Reserved.