public abstract class AbstractApiTask<T> extends Object implements IApiTask<T>, IReadOnly
| Modifier and Type | Field and Description |
|---|---|
protected String |
namespace
The namespace of the target KB instance.
|
protected long |
timestamp
The timestamp of the view of that KB instance.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractApiTask(String namespace,
long timestamp) |
protected |
AbstractApiTask(String namespace,
long timestamp,
boolean isGRSRequired) |
| Modifier and Type | Method and Description |
|---|---|
protected BigdataSailRepositoryConnection |
getConnection()
Return a connection for the namespace.
|
IIndexManager |
getIndexManager()
Return the
IIndexManager. |
long |
getMutationCount() |
String |
getNamespace()
The namespace of the target KB instance.
|
protected BigdataSailRepositoryConnection |
getQueryConnection()
Return a connection transaction, which may be either read-only or support
mutation depending on the timestamp associated with the task's view.
|
protected BigdataSailRepositoryConnection |
getQueryConnection(String namespace,
long timestamp)
This version uses the namespace and timestamp provided by the caller.
|
long |
getTimestamp()
The timestamp of the view of that KB instance.
|
protected BigdataSail.BigdataSailConnection |
getUnisolatedSailConnection() |
boolean |
isGRSRequired()
Tasks that create or destroy locatable resources need to write on the
global row store (GRS).
|
abstract boolean |
isReadOnly()
Return
true iff the procedure asserts that it will not
write on the index. |
void |
setIndexManager(IIndexManager indexManager)
Invoked to inform the task of the index manager before it is executed.
|
static <T> FutureTask<T> |
submitApiTask(IIndexManager indexManager,
IApiTask<T> task)
Submit a task and return a
Future for that task. |
String |
toString() |
protected final String namespace
protected final long timestamp
protected AbstractApiTask(String namespace, long timestamp)
namespace - The namespace of the target KB instance.timestamp - The timestamp of the view of that KB instance.protected AbstractApiTask(String namespace, long timestamp, boolean isGRSRequired)
namespace - The namespace of the target KB instance.timestamp - The timestamp of the view of that KB instance.isGRSRequired - True iff a lock must be obtain on the Global Row Store (GRS).
For example, the GRS is required for create/destroy of a
relation (triple/quad store, etc).public abstract boolean isReadOnly()
IReadOnlytrue iff the procedure asserts that it will not
write on the index. When true, the procedure may be run
against a view of the index that is read-only or which allows concurrent
processes to read on the same index object. When false the
procedure will be run against a mutable view of the index (assuming that
the procedure is executed in a context that has access to a mutable index
view).isReadOnly in interface IReadOnlypublic final String getNamespace()
IApiTaskgetNamespace in interface IApiTask<T>public final long getTimestamp()
IApiTaskgetTimestamp in interface IApiTask<T>public boolean isGRSRequired()
IApiTaskisGRSRequired in interface IApiTask<T>public void setIndexManager(IIndexManager indexManager)
IApiTasksetIndexManager in interface IApiTask<T>indexManager - The index manager.public IIndexManager getIndexManager()
IApiTaskIIndexManager.getIndexManager in interface IApiTask<T>protected BigdataSailRepositoryConnection getQueryConnection() throws org.openrdf.repository.RepositoryException
ITx.UNISOLATED view or a read-write transaction, this will be a
mutable connection.
This version uses the namespace and timestamp associated with the HTTP request.
org.openrdf.repository.RepositoryExceptionDatasetNotFoundExceptionprotected BigdataSailRepositoryConnection getQueryConnection(String namespace, long timestamp) throws org.openrdf.repository.RepositoryException
namespace - timestamp - org.openrdf.repository.RepositoryExceptionDatasetNotFoundExceptionprotected BigdataSail.BigdataSailConnection getUnisolatedSailConnection() throws org.openrdf.sail.SailException, InterruptedException
org.openrdf.sail.SailExceptionInterruptedExceptionprotected BigdataSailRepositoryConnection getConnection() throws org.openrdf.sail.SailException, org.openrdf.repository.RepositoryException
ITx.UNISOLATED view of the
indices, the connection may be used to read or write on the namespace.
Otherwise the connection will be read-only.org.openrdf.sail.SailExceptionorg.openrdf.repository.RepositoryExceptionDatasetNotFoundException - if the specified namespace does not exist.public static <T> FutureTask<T> submitApiTask(IIndexManager indexManager, IApiTask<T> task)
Future for that task. The task will be
run on the appropriate executor service depending on the nature of the
backing database and the view required by the task.
This method returns a Future. Remember to do
Future.get() on the returned Future to await the group
commit.
indexManager - The IndexManager.task - The task.Future for that task.public long getMutationCount()
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.