|
||||||||||
| 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). |
|
protected Properties |
getBareProperties()
Return the Properties object without wrapping it. |
|
int |
getChunkCapacity()
Deprecated. by BOp annotations. |
|
int |
getChunkOfChunksCapacity()
Deprecated. by BOp annotations. |
|
long |
getChunkTimeout()
Deprecated. by BOp annotations. |
|
protected Long |
getCommitTime()
The commit time from which a read-only view was materialized (if known) and otherwise null. |
|
ILocatableResource |
getContainer()
Return the container. |
|
String |
getContainerNamespace()
The identifier for the containing resource. |
|
ExecutorService |
getExecutorService()
|
|
int |
getFullyBufferedReadThreshold()
Deprecated. by BOp annotations. |
|
IIndexManager |
getIndexManager()
Return the object used to locate indices, relations, and relation containers and to execute operations on those resources. |
|
int |
getMaxParallelSubqueries()
Deprecated. by BOp annotations. |
|
String |
getNamespace()
The identifying namespace. |
|
Properties |
getProperties()
Wrap and return 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. |
|
AbstractResource<E> |
init()
The default implementation only logs the event. |
|
boolean |
isForceSerialExecution()
Deprecated. by BOp annotations. |
|
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()
BOp annotations.
AbstractResource.Options.CHUNK_OF_CHUNKS_CAPACITYpublic final int getChunkCapacity()
BOp annotations.
AbstractResource.Options.CHUNK_CAPACITYpublic final long getChunkTimeout()
BOp annotations.
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()
BOp annotations.
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()
BOp annotations.
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()
BOp annotations.
ExecutorService entirely and ONE (1) to submit a single task at a
time to the ExecutorService.
AbstractResource.Options.MAX_PARALLEL_SUBQUERIESpublic 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>protected Long getCommitTime()
null.
https://sourceforge.net/apps/trac/bigdata/ticket/266public final Properties getProperties()
Properties object prevents inadvertent side-effects.
protected final Properties getBareProperties()
Properties object without wrapping it. This method can
be used in those cases where you need to access non-String property
values. The caller is responsible for avoiding mutation to the returned
Properties object.
Note: This explicitly does NOT wrap the properties. Doing so makes it
impossible to access the default properties using Hashtable#get(), which
in turn means that we can not access non-String objects which have been
materialized from the GRS in the Properties. This does introduce
some potential for side-effects between read-only instances of the same
resource view which share the same properties object.
public IIndexManager getIndexManager()
Note: For scale-out, this is always the federation's index manager NOT the data service local index manager. This is an artifact of how we resolve the metadata for the relation against the global row store.
IIndexManager.public final ExecutorService getExecutorService()
public String toString()
toString in class Objectpublic AbstractResource<E> init()
init in interface ILocatableResource<E>public void create()
IMutableResourceILocatableResource.init() is suitable for invocation from
IMutableResource.create(). Instead, you are responsible for invoking ILocatableResource.init()
from this method IFF it is appropriate to reuse its initialization logic.
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 | |||||||||