public class TapeLocalQCacheOpQueue extends Object implements LocalQCacheOpQueue
LocalQCacheOpQueue
using tape for storing LocalQCacheOp
in local fileLocalQCacheOpQueue.QueueId
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.
|
static TapeLocalQCacheOpQueue |
create(File localDirectoryForQueues,
Node node,
int nodeQueueNumber,
boolean replicatePutsViaCopy) |
boolean |
equals(Object o) |
int |
hashCode() |
boolean |
hasPermission() |
LocalQCacheOpQueue.QueueId |
id() |
boolean |
isClosed()
Some operations (
LocalQCacheOpQueue.add(LocalQCacheOp) , LocalQCacheOpQueue.remove() , LocalQCacheOpQueue.peek() , LocalQCacheOpQueue.peekOrBlock() ) on a
closed queue will throw a IllegalStateException . |
String |
name() |
LocalQCacheOp |
peek()
Allows to see whats on the head of the queue without removing it
|
LocalQCacheOp |
peekOrBlock()
see
LocalQCacheOpQueue.peek() but will block when the queue is empty; |
void |
remove()
remove
LocalQCacheOp from head of the queue |
int |
size() |
Long |
usableSpaceInBytes() |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
nodeQueueNumber, nodeQueueNumberForCurrentThread
public static TapeLocalQCacheOpQueue create(File localDirectoryForQueues, Node node, int nodeQueueNumber, boolean replicatePutsViaCopy) throws IOException
IOException
public void close()
LocalQCacheOpQueue
close
in interface LocalQCacheOpQueue
public boolean isClosed()
LocalQCacheOpQueue
LocalQCacheOpQueue.add(LocalQCacheOp)
, LocalQCacheOpQueue.remove()
, LocalQCacheOpQueue.peek()
, LocalQCacheOpQueue.peekOrBlock()
) on a
closed queue will throw a IllegalStateException
.
This method allows to check if the queue has not been closed.isClosed
in interface LocalQCacheOpQueue
public String name()
name
in interface LocalQCacheOpQueue
public LocalQCacheOpQueue.QueueId id()
id
in interface LocalQCacheOpQueue
LocalQCacheOpQueue.QueueId
public boolean add(LocalQCacheOp localQCacheOp) throws IllegalStateException
LocalQCacheOpQueue
LocalQCacheOp
to the queue;
when operation finished we "guarantee" that the LocalQCacheOp
is persistedadd
in interface LocalQCacheOpQueue
IllegalStateException
- when queue is closed@Nullable public LocalQCacheOp peek()
LocalQCacheOpQueue
peek
in interface LocalQCacheOpQueue
@Nullable public LocalQCacheOp peekOrBlock() throws InterruptedException, IllegalStateException
LocalQCacheOpQueue
LocalQCacheOpQueue.peek()
but will block when the queue is empty;peekOrBlock
in interface LocalQCacheOpQueue
InterruptedException
IllegalStateException
- when queue is closed (when calling this method queue is already closed)public void remove() throws NoSuchElementException, IllegalStateException
LocalQCacheOpQueue
LocalQCacheOp
from head of the queueremove
in interface LocalQCacheOpQueue
NoSuchElementException
- when doing a remove on an empty queueIllegalStateException
- when queue is closedpublic int size()
size
in interface LocalQCacheOpQueue
public void backupQueue(String prefix) throws IOException
LocalQCacheOpQueue
LocalQCacheOpQueue.backupQueue(String)
is called between LocalQCacheOpQueue.peek()
and LocalQCacheOpQueue.remove()
this can cause LocalQCacheOpQueue.remove()
to delete a different
LocalQCacheOp
then expected or may throw NoSuchElementException
if the new queue after
LocalQCacheOpQueue.backupQueue(String)
is empty.backupQueue
in interface LocalQCacheOpQueue
IOException
public Long usableSpaceInBytes()
usableSpaceInBytes
in interface LocalQCacheOpQueue
public boolean hasPermission()
hasPermission
in interface LocalQCacheOpQueue
Copyright © 2002-2024 Atlassian. All Rights Reserved.