public interface IConcurrencyManager extends IServiceShutdown
AbstractTask, Base class for tasks to be executed with concurrency control.
|Modifier and Type||Method and Description|
Return declared counters.
The object used to manage local resources.
The client side of the transaction manager.
The service on which read-write tasks are executed.
Executes the given tasks, returning a list of Futures holding their status and results when all complete.
Executes the given tasks, returning a list of Futures holding their status and results when all complete or the timeout expires, whichever happens first.
Normal shutdown - running tasks will run to completion, but no new tasks will start.
Immediate shutdown - running tasks are cancelled rather than being permitted to complete.
Submit a task (asynchronous).
<T> Future<T> submit(AbstractTask<T> task)
Note: Unisolated write tasks will NOT return before the next group commit
(exceptions may be thrown if the task fails or the commit fails). The
purpose of group commits is to provide higher throughput for writes on
the store by only syncing the data to disk periodically rather than after
every write. Group commits are scheduled by the
The trigger conditions for group commits may be configured using
ConcurrencyManager.Options. If you are using the store in a
single threaded context then you may set
Options#WRITE_SERVICE_CORE_POOL_SIZE to ONE (1) which has the
effect of triggering commit immediately after each unisolated write.
However, note that you can not sync a disk more than ~ 30-40 times per
second so your throughput in write operations per second will never
exceed that for a single-threaded application writing on a hard disk.
(Your mileage can vary if you are writing on a transient store or using a
durable medium other than disk).
Note: The isolated indices used by a read-write transaction are NOT thread-safe. Therefore a partial order is imposed over concurrent tasks for the same transaction that seek to read or write on the same index(s). Full concurrency is allowed when different transactions access the same index(s), but write-write conflicts MAY be detected during commit processing.
Note: The following exceptions MAY be wrapped by
tasks submitted via this method:
shutdown()after the timeout has expired or
shutdownNow(). In either of these cases the task will not be accepted by the journal.
<T> List<Future<T>> invokeAll(Collection<? extends AbstractTask<T>> tasks) throws InterruptedException
Note: Contract is per
List<Future> invokeAll(Collection<? extends AbstractTask> tasks, long timeout, TimeUnit unit) throws InterruptedException
Note: Contract is based on
ExecutorService.invokeAll(Collection, long, TimeUnit) but only
Futures of the submitted tasks are returned.
tasks- The tasks.
Futures of all tasks that were
submittedprior to the expiration of the timeout.
InterruptedException- if interrupted while waiting, in which case unfinished tasks are cancelled.
NullPointerException- if tasks or any of its elements are null
RejectedExecutionException- if any task cannot be scheduled for execution FIXME Figure out why a generic for the future type causes errors under some java 1.6.0_07 and 1.6.0_10 compilers. It does not seem to be a problem in the variant w/o the timeout, which is very, very strange.
Copyright © 2006-2014 SYSTAP, LLC. All Rights Reserved.