|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.relation.AbstractResource<E>
E - public abstract class AbstractResource<E>
Base class for locatable resources.
| Nested Class Summary | |
|---|---|
static interface |
AbstractResource.Options
Options for locatable resources. |
| Field Summary | |
|---|---|
protected static org.apache.log4j.Logger |
log
|
| Constructor Summary | |
|---|---|
protected |
AbstractResource(IIndexManager indexManager,
String namespace,
Long timestamp,
Properties properties)
|
| Method Summary | ||
|---|---|---|
protected IResourceLock |
acquireExclusiveLock()
Acquires an exclusive lock for the getNamespace(). |
|
void |
create()
Create any logically contained resources (relations, indices). |
|
void |
destroy()
Destroy any logically contained resources (relations, indices). |
|
int |
getChunkCapacity()
The target chunk size. |
|
int |
getChunkOfChunksCapacity()
The capacity of the buffers accumulating chunks from concurrent producers. |
|
long |
getChunkTimeout()
The timeout in milliseconds that the BlockingBuffer will wait for
another chunk to combine with the current chunk before returning the
current chunk. |
|
ILocatableResource |
getContainer()
Return the container. |
|
String |
getContainerNamespace()
The identifier for the containing resource. |
|
ExecutorService |
getExecutorService()
|
|
int |
getFullyBufferedReadThreshold()
If the estimated range count for an IAccessPath.iterator(int, int) is LTE this threshold then do a
fully buffered (synchronous) read. |
|
IIndexManager |
getIndexManager()
Return the object used to locate indices, relations, and relation containers and to execute operations on those resources. |
|
int |
getMaxParallelSubqueries()
The maximum #of subqueries for the first join dimension that will be issued in parallel. |
|
String |
getNamespace()
The identifying namespace. |
|
Properties |
getProperties()
Return an object wrapping the properties specified to the ctor. |
|
protected String |
getProperty(String localName,
String defaultValue)
Resolve the property value using the IIndexManager, the
namespace of the resource, and the Properties instance to be
tested as hidden parameters. |
|
protected
|
getProperty(String name,
String defaultValue,
IValidator<T> validator)
Resolves, parses, and validates the property value. |
|
long |
getTimestamp()
The timestamp associated with the view of the resource. |
|
boolean |
isForceSerialExecution()
When true, rule sets will be forced to execute
sequentially even when they are not flagged as a sequential program. |
|
boolean |
isNestedSubquery()
When true the NestedSubqueryWithJoinThreadsTask is
applied. |
|
String |
toString()
The class name, timestamp and namespace for the relation view. |
|
protected void |
unlock(IResourceLock resourceLock)
Release the lock. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final transient org.apache.log4j.Logger log
| Constructor Detail |
|---|
protected AbstractResource(IIndexManager indexManager,
String namespace,
Long timestamp,
Properties properties)
| Method Detail |
|---|
public final int getChunkOfChunksCapacity()
AbstractResource.Options.CHUNK_OF_CHUNKS_CAPACITYpublic final int getChunkCapacity()
AbstractResource.Options.CHUNK_CAPACITYpublic final long getChunkTimeout()
BlockingBuffer will wait for
another chunk to combine with the current chunk before returning the
current chunk. This may be ZERO (0) to disable the chunk combiner.
AbstractResource.Options.CHUNK_TIMEOUTpublic int getFullyBufferedReadThreshold()
IAccessPath.iterator(int, int) is LTE this threshold then do a
fully buffered (synchronous) read. Otherwise we will do an asynchronous
read.
AbstractResource.Options.FULLY_BUFFERED_READ_THRESHOLDpublic boolean isForceSerialExecution()
true, rule sets will be forced to execute
sequentially even when they are not flagged as a sequential program.
AbstractResource.Options.FORCE_SERIAL_EXECUTIONpublic int getMaxParallelSubqueries()
ExecutorService entirely and ONE (1) to submit a single task at a
time to the ExecutorService.
AbstractResource.Options.MAX_PARALLEL_SUBQUERIESpublic boolean isNestedSubquery()
true the NestedSubqueryWithJoinThreadsTask is
applied. Otherwise the JoinMasterTask is applied.
AbstractResource.Options.NESTED_SUBQUERYpublic final String getNamespace()
ILocatableResource
getNamespace in interface ILocatableResource<E>public final String getContainerNamespace()
ILocatableResource
getContainerNamespace in interface ILocatableResource<E>null
if there is no containing resource.public ILocatableResource getContainer()
null if there is no container.public final long getTimestamp()
ILocatableResource
getTimestamp in interface ILocatableResource<E>public final Properties getProperties()
public IIndexManager getIndexManager()
IIndexManager.public final ExecutorService getExecutorService()
public String toString()
toString in class Objectpublic void create()
IMutableResource
create in interface IMutableResource<E>
There is existing code that could be adapted for this purpose. It
might have to be adapted to support lock escalation (shared to
exclusive), a resource hierarchy, and a delay queue to cancel
leases that are not renewed. It would have to be wrapped up as a
low-latency service and made available via the
IBigdataFederation. It also needs to use a weak reference
cache for the collection of resource queues so that they are GC'd
rather than growing as new resources are locked and never
shrinking.
If we require pre-declaration of locks, then we do not need the dependency graph since deadlocks can only arise with 2PL.
Since the service is remote it should use UUIDs to
identify the lock owner(s).
The lock service would be used to bracket operations such as
relation create() and destroy() and would be used
to prevent those operations while a lease is held by concurrent
processes with a shared lock.
Add ctor flag to create iff not found?
There needs to be a lock protocol for subclasses so that they can ensure that they are the only task running create (across the federation) and so that they can release the lock when they are done. The lock can be per the notes above, but the protocol with the subclass will require some coordinating methods.
Full transactions are another way to solve this problem.
public void destroy()
IMutableResource
destroy in interface IMutableResource<E>protected IResourceLock acquireExclusiveLock()
getNamespace().
RuntimeException - if anything goes wrong.IResourceLockServiceprotected void unlock(IResourceLock resourceLock)
resourceLock - The lock.
protected String getProperty(String localName,
String defaultValue)
IIndexManager, the
namespace of the resource, and the Properties instance to be
tested as hidden parameters.
globalName - The global property name.defaultValue - The default.
Configuration
protected <T> T getProperty(String name,
String defaultValue,
IValidator<T> validator)
name - The property name.defaultValue - The default value.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||