public interface IConcurrencyManager extends IServiceShutdown, ICounterSetAccess
AbstractTask, Base class for tasks to be executed with concurrency
control.
IServiceShutdown.Options
Modifier and Type | Method and Description |
---|---|
IResourceManager |
getResourceManager()
The object used to manage local resources.
|
ILocalTransactionManager |
getTransactionManager()
The client side of the transaction manager.
|
WriteExecutorService |
getWriteService()
The service on which read-write tasks are executed.
|
<T> List<Future<T>> |
invokeAll(Collection<? extends AbstractTask<T>> tasks)
Executes the given tasks, returning a list of Futures holding their
status and results when all complete.
|
<T> List<Future<T>> |
invokeAll(Collection<? extends AbstractTask<T>> tasks,
long timeout,
TimeUnit unit)
Executes the given tasks, returning a list of Futures holding their
status and results when all complete or the timeout expires, whichever
happens first.
|
void |
shutdown()
Normal shutdown - running tasks will run to completion, but no new tasks
will start.
|
void |
shutdownNow()
Immediate shutdown - running tasks are cancelled rather than being
permitted to complete.
|
<T> FutureTask<T> |
submit(AbstractTask<T> task)
Submit a task (asynchronous).
|
isOpen
getCounters
ILocalTransactionManager getTransactionManager()
IResourceManager getResourceManager()
void shutdown()
shutdown
in interface IServiceShutdown
shutdownNow()
void shutdownNow()
shutdownNow
in interface IServiceShutdown
shutdown()
<T> FutureTask<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 #commitService
.
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 Future.get()
for
tasks submitted via this method:
ValidationError
InterruptedException
shutdown()
after the timeout has expired or
shutdownNow()
. In either of these cases the task will not be
accepted by the journal.task
- The task.Future
that may be used to resolve the outcome of the
task.RejectedExecutionException
- if task cannot be scheduled for execution (typically the
queue has a limited capacity and is full)NullPointerException
- if task is null
<T> List<Future<T>> invokeAll(Collection<? extends AbstractTask<T>> tasks) throws InterruptedException
Note: Contract is per ExecutorService.invokeAll(Collection)
tasks
- The tasks.Future
s.InterruptedException
- if interrupted while waiting, in which case unfinished
tasks are cancelled.NullPointerException
- if tasks or any of its elements are nullRejectedExecutionException
- if any task cannot be scheduled for execution<T> List<Future<T>> invokeAll(Collection<? extends AbstractTask<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException
Note: Contract is based on
ExecutorService.invokeAll(Collection, long, TimeUnit)
but only
the Future
s of the submitted tasks are returned.
tasks
- The tasks.Future
s of all tasks that were
submitted
prior 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 nullRejectedExecutionException
- if any task cannot be scheduled for executionWriteExecutorService getWriteService()
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.