
public abstract class BatchPersister<T> extends Object implements Runnable, org.lsst.ccs.framework.HasLifecycle
| Modifier and Type | Field and Description |
|---|---|
protected org.lsst.ccs.services.alert.AlertService |
alertService |
protected org.lsst.ccs.utilities.logging.Logger |
log |
| Constructor and Description |
|---|
BatchPersister(int nMax,
boolean flushAtCommit)
Constructor for a batch persister.
|
BatchPersister(int nMax,
boolean flushAtCommit,
int threads)
Constructor for a batch persister.
|
BatchPersister(int nMax,
boolean flushAtCommit,
int threads,
int threadQueueSize)
Constructor for a batch persister.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addToQueue(T obj) |
void |
init() |
static ExecutorService |
newFixedThreadPoolBoundedQueue(int nThreads,
int nQueue) |
abstract void |
persist(T obj,
org.hibernate.Session sess)
Called from inside an open transaction.
|
void |
run() |
protected final org.lsst.ccs.utilities.logging.Logger log
@LookupField(strategy=TREE) protected org.lsst.ccs.services.alert.AlertService alertService
public BatchPersister(int nMax,
boolean flushAtCommit,
int threads,
int threadQueueSize)
nMax - The maximum number of entities to persist in a single
transaction.flushAtCommit - true if the session that process the batch should be set to
FlushMode.COMMITthreads - database feeding threadsthreadQueueSize - The size of the queue; if negative the queue is unbound.public BatchPersister(int nMax,
boolean flushAtCommit,
int threads)
nMax - The maximum number of entities to persist in a single
transaction.flushAtCommit - true if the session that process the batch should be set to
FlushMode.COMMITthreads - database feeding threadspublic BatchPersister(int nMax,
boolean flushAtCommit)
nMax - The maximum number of entities to persist in a single
transaction.flushAtCommit - true if the session that process the batch should be set to
FlushMode.COMMITpublic static ExecutorService newFixedThreadPoolBoundedQueue(int nThreads, int nQueue)
public void init()
init in interface org.lsst.ccs.framework.HasLifecyclepublic void addToQueue(T obj)
public abstract void persist(T obj, org.hibernate.Session sess)
obj - sess - Copyright © 2022 LSST. All rights reserved.