|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.service.AbstractFederation<T>
T - The generic type of the client or service.public abstract class AbstractFederation<T>
Abstract base class for IBigdataFederation implementations.
IServiceShutdown. When it is declared here it messes
up the Options interface hierarchy. What appears to be happening is
that the IServiceShutdown.Options interface is flattened into
IServiceShutdown and it shadows the Options that are being used.| Nested Class Summary | |
|---|---|
static class |
AbstractFederation.ReportTask
Periodically report performance counter data to the ILoadBalancerService. |
protected class |
AbstractFederation.StartDeferredTasksTask
This task runs periodically. |
| Field Summary | |
|---|---|
protected static org.apache.log4j.Logger |
log
|
| Constructor Summary | |
|---|---|
protected |
AbstractFederation(IBigdataClient<T> client)
|
| Method Summary | |
|---|---|
ScheduledFuture |
addScheduledTask(Runnable task,
long initialDelay,
long delay,
TimeUnit unit)
Adds a task which will run until canceled, until it throws an exception, or until the federation is shutdown(). |
protected void |
assertOpen()
|
void |
destroy()
Destroys all discovered services belonging to the federation and their persistent data and disconnects from the federation. |
void |
didStart()
Delegated. |
void |
dropIndex(String name)
Drop a scale-out index. |
AbstractClient<T> |
getClient()
Return the client object that was used to connect to the federation. |
CounterSet |
getCounterSet()
The CounterSet which the client will use report its statistics to
the ILoadBalancerService. |
IDataService[] |
getDataServices(UUID[] uuids)
Return an array of IDataService references that is correlated
with the given array of IDataService UUIDs. |
ExecutorService |
getExecutorService()
A thread pool that may be used by clients to parallelize operations against the federation. |
BigdataFileSystem |
getGlobalFileSystem()
Return the global file system used to store block-structured files and their metadata and as a source and sink for map/reduce processing. |
SparseRowStore |
getGlobalRowStore()
Return the global SparseRowStore used to store named property
sets in the federation. |
CounterSet |
getHostCounterSet()
The node in IBigdataFederation.getCounterSet() corresponding to the root of the
host on which the client or service is executing. |
String |
getHttpdURL()
The URL that may be used to access the local httpd service for this client or service. |
IClientIndex |
getIndex(String name,
long timestamp)
Applies an AbstractIndexCache and strengthens the return type. |
protected abstract AbstractIndexCache<? extends IClientIndex> |
getIndexCache()
Return the cache for IIndex objects. |
ScaleOutIndexCounters |
getIndexCounters(String name)
Return the ScaleOutIndexCounters for the specified scale-out index
for this client. |
DefaultResourceLocator |
getResourceLocator()
Return the default locator for resources that are logical index containers (relations and relation containers). |
ScheduledExecutorService |
getScheduledExecutorService()
A service which may be used to schedule performance counter sampling tasks. |
T |
getService()
Delegated. |
String |
getServiceCounterPathPrefix()
The path prefix under which all of the client or service's counters are located. |
static String |
getServiceCounterPathPrefix(UUID serviceUUID,
Class serviceIface,
String hostname)
The path prefix under which all of the client or service's counters are located. |
CounterSet |
getServiceCounterSet()
The node in IBigdataFederation.getCounterSet() corresponding to the root of the
client or service connected using this federation. |
Class |
getServiceIface()
Delegated. |
String |
getServiceName()
Delegated. |
UUID |
getServiceUUID()
Delegated. |
TaskCounters |
getTaskCounters()
Return the TaskCounters which aggregate across all operations
performed by the client against the connected federation. |
TemporaryStore |
getTempStore()
A factory for TemporaryStores. |
boolean |
isOpen()
|
boolean |
isServiceReady()
Delegated. |
AbstractHTTPD |
newHttpd(int httpdPort,
CounterSet counterSet)
Delegated. |
void |
reattachDynamicCounters()
Delegated. |
void |
registerIndex(IndexMetadata metadata)
Register a scale-out index. |
UUID |
registerIndex(IndexMetadata metadata,
byte[][] separatorKeys,
UUID[] dataServiceUUIDs)
Register and statically partition a scale-out index. |
UUID |
registerIndex(IndexMetadata metadata,
UUID dataServiceUUID)
Register a scale-out index and assign the initial index partition to the specified data service. |
void |
reportCounters()
Forces the immediate reporting of the CounterSet to the
ILoadBalancerService. |
protected void |
sendEvent(Event e)
Queues up an event to be sent to the ILoadBalancerService. |
void |
serviceJoin(IService service,
UUID serviceUUID)
Notice that the service has been discovered. |
void |
serviceLeave(UUID serviceUUID)
Notice that the service is no longer available. |
void |
shutdown()
Normal shutdown allows any existing client requests to federation services to complete but does not schedule new requests, disconnects from the federation, and then terminates any background processing that is being performed on the behalf of the client (service discovery, etc). |
void |
shutdownNow()
Immediate shutdown terminates any client requests to federation services, disconnects from the federation, and then terminate any background processing that is being performed on the behalf of the client (service discovery, etc). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.bigdata.service.IBigdataFederation |
|---|
getAnyDataService, getDataService, getDataServiceByName, getDataServiceUUIDs, getLastCommitTime, getLoadBalancerService, getMetadataIndex, getMetadataService, getTransactionService, isDistributed, isScaleOut, isStable |
| Methods inherited from interface com.bigdata.journal.IIndexStore |
|---|
getResourceLockService |
| Field Detail |
|---|
protected static final org.apache.log4j.Logger log
| Constructor Detail |
|---|
protected AbstractFederation(IBigdataClient<T> client)
| Method Detail |
|---|
public AbstractClient<T> getClient()
IBigdataFederation
getClient in interface IBigdataFederation<T>public final boolean isOpen()
public void shutdown()
Note: concrete implementations MUST extend this method.
Note: Clients use IBigdataClient.disconnect(boolean) to
disconnect from a federation. The federation implements that disconnect
using either shutdown() or shutdownNow().
The implementation must be a NOP if the federation is already shutdown.
public void shutdownNow()
Note: concrete implementations MUST extend this method to either
disconnect from the remote federation or close the embedded federation
and then clear the #fed reference so that the client is no longer
"connected" to the federation.
Note: Clients use IBigdataClient.disconnect(boolean) to disconnect
from a federation. The federation implements that disconnect using either
shutdown() or shutdownNow().
The implementation must be a NOP if the federation is already shutdown.
public void destroy()
IBigdataFederation
destroy in interface IIndexStoredestroy in interface IBigdataFederation<T>protected void assertOpen()
IllegalStateException - if the client has disconnected from the federation.public ScheduledExecutorService getScheduledExecutorService()
public final String getHttpdURL()
IBigdataFederation
getHttpdURL in interface IBigdataFederation<T>null if the httpd service is not
running.public DefaultResourceLocator getResourceLocator()
IIndexStore
getResourceLocator in interface IIndexStorepublic TaskCounters getTaskCounters()
TaskCounters which aggregate across all operations
performed by the client against the connected federation. These
TaskCounters are sampled by a
ThreadPoolExecutorStatisticsTask and the sampled data are
reported by the client to the ILoadBalancerService.
public ScaleOutIndexCounters getIndexCounters(String name)
ScaleOutIndexCounters for the specified scale-out index
for this client. There is only a single instance per scale-out index and
all operations by this client on that index are aggregated by that
instance. These counters are reported by the client to the
ILoadBalancerService.
name - The scale-out index name.
public ScheduledFuture addScheduledTask(Runnable task,
long initialDelay,
long delay,
TimeUnit unit)
shutdown().
Note: Tasks run on this service generally update sampled values on
ICounters reported to the ILoadBalancerService. Basic
information on the getExecutorService() is reported
automatically. Clients may add additional tasks to report on client-side
aspects of their application.
Note: Non-sampled counters are automatically conveyed to the
ILoadBalancerService once added to the basic CounterSet
returned by getCounterSet().
task - The task.initialDelay - The initial delay.delay - The delay between invocations.unit - The units for the delay parameters.
ScheduledFuture for that task.public CounterSet getCounterSet()
IBigdataFederationCounterSet which the client will use report its statistics to
the ILoadBalancerService.
Note: Applications MAY add their own counters (within a suitable
namespace) to the returned CounterSet in order to report their
own performance data to the ILoadBalancerService.
getCounterSet in interface IBigdataFederation<T>IBigdataFederation.getServiceCounterSet(),
IBigdataFederation.getServiceCounterPathPrefix()public CounterSet getHostCounterSet()
IBigdataFederationIBigdataFederation.getCounterSet() corresponding to the root of the
host on which the client or service is executing.
getHostCounterSet in interface IBigdataFederation<T>public CounterSet getServiceCounterSet()
IBigdataFederationIBigdataFederation.getCounterSet() corresponding to the root of the
client or service connected using this federation.
getServiceCounterSet in interface IBigdataFederation<T>public String getServiceCounterPathPrefix()
IBigdataFederationICounterSet.pathSeparator.
getServiceCounterPathPrefix in interface IBigdataFederation<T>IBigdataFederation.getServiceCounterSet()
public static String getServiceCounterPathPrefix(UUID serviceUUID,
Class serviceIface,
String hostname)
ICounterSet.pathSeparator.
serviceUUID - The service UUID.serviceIface - The primary interface or class for the service.hostname - The fully qualified name of the host on which the service is
running.public ExecutorService getExecutorService()
IBigdataFederationClientIndexView.
getExecutorService in interface IIndexStoregetExecutorService in interface IBigdataFederation<T>public void registerIndex(IndexMetadata metadata)
IBigdataFederation
registerIndex in interface IIndexManagerregisterIndex in interface IBigdataFederation<T>metadata - The metadata template used to create component indices for
BTrees this scale-out index (this also specifies the
name of the scale-out index).
public UUID registerIndex(IndexMetadata metadata,
UUID dataServiceUUID)
IBigdataFederation
registerIndex in interface IBigdataFederation<T>metadata - The metadata template used to create component indices for
BTrees this scale-out index (this also specifies the
name of the scale-out index).dataServiceUUID - The data service identifier (optional). When null,
a data service will be selected automatically. If
IndexMetadata.Options#INITIAL_DATA_SERVICE was
specified, then the identified service will be used. Otherwise
an underutilized service will be selected using the
ILoadBalancerService.
IndexMetadata.Options#INITIAL_DATA_SERVICE
public UUID registerIndex(IndexMetadata metadata,
byte[][] separatorKeys,
UUID[] dataServiceUUIDs)
IBigdataFederation
registerIndex in interface IBigdataFederation<T>metadata - The metadata template used to create component indices for
BTrees this scale-out index (this also specifies the
name of the scale-out index).separatorKeys - The array of separator keys. Each separator key is interpreted
as an unsigned byte[]. The first entry MUST be an
empty byte[]. The entries MUST be in sorted order.dataServiceUUIDs - The array of data services onto which each partition defined
by a separator key will be mapped (optional). When given, the
#of entries in this array MUST agree with the #of entries in
the separatorKeys array and all entries must be non-null.
When not given, the index partitions will be auto-assigned to
the discovered data services.
protected abstract AbstractIndexCache<? extends IClientIndex> getIndexCache()
IIndex objects.
public IClientIndex getIndex(String name,
long timestamp)
AbstractIndexCache and strengthens the return type.
Obtain a view on a partitioned index.
getIndex in interface IIndexStoregetIndex in interface IBigdataFederation<T>name - The index name.timestamp - A transaction identifier, ITx.UNISOLATED for the
unisolated index view, ITx.READ_COMMITTED, or
timestamp for a historical view no later than
the specified timestamp.
null if the index does not exist.public void dropIndex(String name)
IBigdataFederation
dropIndex in interface IIndexManagerdropIndex in interface IBigdataFederation<T>name - The index name.public SparseRowStore getGlobalRowStore()
IBigdataFederationSparseRowStore used to store named property
sets in the federation.
getGlobalRowStore in interface IIndexStoregetGlobalRowStore in interface IBigdataFederation<T>GlobalRowStoreSchemapublic BigdataFileSystem getGlobalFileSystem()
IIndexStore
getGlobalFileSystem in interface IIndexStoreBigdataFileSystempublic TemporaryStore getTempStore()
IIndexStoreTemporaryStores. TemporaryStores are
thread-safe and may be used by multiple processes at once. Old
TemporaryStores are eventually retired by the factory and their
storage is reclaimed once they are finalized (after they are no longer in
use by any process). The decision to retire a TemporaryStore is
either made implicitly, when it is no longer weakly reachable, or
explicitly, when it has grown large enough that no new processes should
begin using that TemporaryStore. In the latter case, the
TemporaryStore will remain available to the process(es) using it
and a new TemporaryStore will be allocated and made available to
the caller.
It is important that processes do not hold a hard reference to a
TemporaryStore beyond the end of the process as that will prevent
the TemporaryStore from being finalized. Holding reference to an
AbstractBTree created on a TemporaryStore is equivalent
to holding a hard reference to the TemporaryStore itself since
the AbstractBTree holds onto the backing IRawStore using
a hard reference.
getTempStore in interface IIndexStoreTemporaryStore.public void reportCounters()
CounterSet to the
ILoadBalancerService. Any errors will be logged, not thrown.
public T getService()
getService in interface IFederationDelegate<T>public String getServiceName()
getServiceName in interface IFederationDelegate<T>public Class getServiceIface()
getServiceIface in interface IFederationDelegate<T>null.public UUID getServiceUUID()
getServiceUUID in interface IFederationDelegate<T>AbstractService.setServiceUUID(UUID)public boolean isServiceReady()
isServiceReady in interface IFederationDelegate<T>public void reattachDynamicCounters()
reattachDynamicCounters in interface IFederationDelegate<T>public void didStart()
didStart in interface IFederationDelegate<T>
public AbstractHTTPD newHttpd(int httpdPort,
CounterSet counterSet)
throws IOException
newHttpd in interface IFederationDelegate<T>counterSet - The root CounterSet that will be served up.
IOException
public void serviceJoin(IService service,
UUID serviceUUID)
IFederationDelegateIBigdataClient.
serviceJoin in interface IFederationDelegate<T>service - The service.serviceUUID - The service UUID.public void serviceLeave(UUID serviceUUID)
IFederationDelegateIBigdataClient when the service is no
longer available from any of its service registrars.
serviceLeave in interface IFederationDelegate<T>serviceUUID - The service UUID.public IDataService[] getDataServices(UUID[] uuids)
IBigdataFederationIDataService references that is correlated
with the given array of IDataService UUIDs.
Note: This method will also resolve the UUID of an
IMetadataService.
getDataServices in interface IBigdataFederation<T>protected void sendEvent(Event e)
ILoadBalancerService.
Events are maintained on a non-blocking queue (no fixed capacity) and
sent by a scheduled task.
e - SendEventsTask
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||