public class DualRandomAccessFileQueueStoreDelegate extends AbstractQueueStoreDelegate implements TransactionalQueueStoreDelegate
TransactionalQueueStoreDelegate
implementation using two files for storing the
queue data.
Entries are stored in the queue file until a certain size in the file. After that size is reached a new file is created
and used to store new entries until the previous file queue entries are consumed, in which case the file is cleaned and reused
for new entries once the second files gets full.Modifier and Type | Field and Description |
---|---|
protected Log |
logger |
static String |
MAX_LENGTH_PER_FILE_PROPERTY_KEY |
Constructor and Description |
---|
DualRandomAccessFileQueueStoreDelegate(String queueName,
String workingDirectory,
MuleContext muleContext,
int capacity) |
Modifier and Type | Method and Description |
---|---|
protected void |
add(Serializable item)
Adds an item at the end of the queue
|
protected void |
addFirst(Serializable item)
Adds an object at the beginning of the queue
|
Collection<Serializable> |
allElements() |
void |
close()
Releases all resources managed by this queue without removing the queue data.
|
boolean |
contains(Serializable value)
checks if the given value exists in the queue
Used only during recovery phase which means this method does not
require great performance
|
void |
dispose()
Deletes the queue and it's content.
|
protected boolean |
doAddAll(Collection<? extends Serializable> items)
Adds all the items at the end of the queue
|
void |
doClear()
Removes all the items in the queue
|
protected Serializable |
getFirst()
reads the first element in the queue
|
static File |
getFirstQueueFileForTesting(String queueName,
String workingDirectory) |
protected boolean |
isEmpty() |
void |
remove(Serializable value)
Remove the specified value from the queue.
|
protected Serializable |
removeFirst()
removes the first element in the queue
|
int |
size() |
addAll, clear, getSize, offer, peek, poll, putNow, untake
public static final String MAX_LENGTH_PER_FILE_PROPERTY_KEY
protected final Log logger
public DualRandomAccessFileQueueStoreDelegate(String queueName, String workingDirectory, MuleContext muleContext, int capacity)
public static File getFirstQueueFileForTesting(String queueName, String workingDirectory)
protected void addFirst(Serializable item) throws InterruptedException
AbstractQueueStoreDelegate
addFirst
in class AbstractQueueStoreDelegate
item
- object to addInterruptedException
protected void add(Serializable item)
AbstractQueueStoreDelegate
add
in class AbstractQueueStoreDelegate
item
- object to addprotected Serializable removeFirst() throws InterruptedException
AbstractQueueStoreDelegate
removeFirst
in class AbstractQueueStoreDelegate
InterruptedException
protected Serializable getFirst() throws InterruptedException
AbstractQueueStoreDelegate
getFirst
in class AbstractQueueStoreDelegate
InterruptedException
public int size()
size
in class AbstractQueueStoreDelegate
protected boolean isEmpty()
isEmpty
in class AbstractQueueStoreDelegate
public void doClear()
AbstractQueueStoreDelegate
doClear
in class AbstractQueueStoreDelegate
protected boolean doAddAll(Collection<? extends Serializable> items)
AbstractQueueStoreDelegate
doAddAll
in class AbstractQueueStoreDelegate
items
- objects to addpublic Collection<Serializable> allElements()
public void remove(Serializable value)
TransactionalQueueStoreDelegate
remove
in interface TransactionalQueueStoreDelegate
value
- object to be removedpublic boolean contains(Serializable value)
TransactionalQueueStoreDelegate
contains
in interface TransactionalQueueStoreDelegate
value
- object to check if exists in the queuepublic void close()
TransactionalQueueStoreDelegate
close
in interface TransactionalQueueStoreDelegate
public void dispose()
QueueStoreDelegate
dispose
in interface QueueStoreDelegate
Copyright © 2003–2015 MuleSoft, Inc.. All rights reserved.