public class BackgroundLoadSave extends Object
Utility class that can be used by FileLoader or DBInterface implementations to provide a worker thread pool to load/save the file data using a queue of file load/save requests.
Modifier and Type | Class and Description |
---|---|
protected class |
BackgroundLoadSave.QueueLoader
Queue Loader Thread Inner Class
|
protected class |
BackgroundLoadSave.ThreadWorker
Thread Worker Inner Class
|
protected class |
BackgroundLoadSave.TransactionQueueLoader
Transaction Queue Loader Thread Inner Class
|
Modifier and Type | Field and Description |
---|---|
static String |
DBFileSegmentInfo |
static long |
DefaultTransactionTimeout |
static int |
DefaultWorkerThreads |
static long |
MaximumTransactionTimeout |
static int |
MaximumWorkerThreads |
static long |
MinimumTransactionTimeout |
static int |
MinimumWorkerThreads |
static long |
RequestProcessedExpire |
static int |
RequestQueueDefaultSize |
static long |
RequestQueuedExpire |
static int |
RequestQueueLowWaterMark |
static int |
RequestQueueMaxSize |
static int |
RequestQueueMinSize |
static int |
RequeueMinSize |
static long |
RequeueWaitTime |
static long |
SequentialFileExpire |
static int |
StsError |
static int |
StsRequeue |
static int |
StsSuccess |
Constructor and Description |
---|
BackgroundLoadSave(DBQueueInterface dbQueue,
FileStateCache stateCache,
BackgroundFileLoader bgLoader)
Class constructor
|
BackgroundLoadSave(String name,
DBQueueInterface dbQueue,
FileStateCache stateCache,
BackgroundFileLoader bgLoader)
Class constructor
|
Modifier and Type | Method and Description |
---|---|
protected FileState |
createFileStateForRequest(int fid,
String tempPath,
String virtPath,
int sts)
Re-create, or attach, a file request to the file state.
|
void |
enableTransactions()
Enable transactions, start the transaction loader thread
|
void |
flushTransaction(int tranId)
Flush the current pending transaction request
|
DBQueueInterface |
getDBQueueInterface()
Return the database queue interface
|
BackgroundFileLoader |
getFileLoader()
Return the file loader interface
|
long |
getFileStateTimeout()
Return the default file state timeout
|
int |
getLowQueueSize()
Return the in-memory file request queue low water mark level
|
int |
getMaximumQueueSize()
Return the maximum in-memory file request queue size
|
String |
getName()
Return the worker thread prefix
|
BackgroundLoadSave.QueueLoader |
getReadLoader()
Return the read loader
|
protected FileRequestQueue |
getReadQueue()
Return the read request queue
|
int |
getReadWorkers()
Return the number of read worker threads
|
protected FileStateCache |
getStateCache()
Return the file state cache
|
BackgroundLoadSave.QueueLoader |
getWriteLoader()
Return the write loader
|
protected FileRequestQueue |
getWriteQueue()
Return the write request queue
|
int |
getWriteWorkers()
Return the number of write worker threads
|
boolean |
hasDebug()
Check if debug output is enabled
|
void |
queueFileRequest(FileRequest req)
Request file data to be loaded/saved
|
void |
setDebug(boolean dbg)
Enable/disable debug output
|
void |
setLowQueueSize(int lowqSize)
Set the in-memory file request queue low water mark level
|
void |
setMaximumQueueSize(int qsize)
Set the maximum in-memory file request queue size
|
void |
setName(String name)
Set the worker thread name prefix
|
void |
setReadWorkers(int rdWorkers)
Set the number of read worker threads
|
void |
setWriteWorkers(int wrWorkers)
Set the number of write worker threads
|
void |
shutdownThreads()
Shutdown the background load/save thread pool
|
void |
startThreads(int recCnt)
Start the background load/save thread pool
|
public static final int StsSuccess
public static final int StsRequeue
public static final int StsError
public static final int DefaultWorkerThreads
public static final int MinimumWorkerThreads
public static final int MaximumWorkerThreads
public static final int RequestQueueMaxSize
public static final int RequestQueueMinSize
public static final int RequestQueueDefaultSize
public static final int RequestQueueLowWaterMark
public static final int RequeueMinSize
public static final long RequeueWaitTime
public static final String DBFileSegmentInfo
public static final long SequentialFileExpire
public static final long RequestProcessedExpire
public static final long RequestQueuedExpire
public static final long DefaultTransactionTimeout
public static final long MinimumTransactionTimeout
public static final long MaximumTransactionTimeout
public BackgroundLoadSave(DBQueueInterface dbQueue, FileStateCache stateCache, BackgroundFileLoader bgLoader)
dbQueue
- DBQueueInterfacestateCache
- FileStateCachebgLoader
- BackgroundFileLoaderpublic BackgroundLoadSave(String name, DBQueueInterface dbQueue, FileStateCache stateCache, BackgroundFileLoader bgLoader)
name
- StringdbQueue
- DBQueueInterfacestateCache
- FileStateCachebgLoader
- BackgroundFileLoaderpublic final void startThreads(int recCnt)
recCnt
- intpublic final void enableTransactions()
public final void shutdownThreads()
public void queueFileRequest(FileRequest req)
req
- FileRequestpublic final void flushTransaction(int tranId)
tranId
- intpublic final boolean hasDebug()
public final DBQueueInterface getDBQueueInterface()
public final BackgroundFileLoader getFileLoader()
public final long getFileStateTimeout()
public final int getMaximumQueueSize()
public final int getLowQueueSize()
public final String getName()
protected final FileRequestQueue getReadQueue()
public final BackgroundLoadSave.QueueLoader getReadLoader()
protected final FileRequestQueue getWriteQueue()
public final BackgroundLoadSave.QueueLoader getWriteLoader()
public final int getReadWorkers()
public final int getWriteWorkers()
protected final FileStateCache getStateCache()
public final void setName(String name)
name
- Stringpublic final void setDebug(boolean dbg)
dbg
- booleanpublic final void setMaximumQueueSize(int qsize)
qsize
- intpublic final void setLowQueueSize(int lowqSize)
lowqSize
- intpublic final void setReadWorkers(int rdWorkers)
rdWorkers
- intpublic final void setWriteWorkers(int wrWorkers)
wrWorkers
- intCopyright © 2005–2017 Alfresco Software. All rights reserved.