|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.service.AbstractFederation<T>
com.bigdata.service.AbstractScaleOutFederation<T>
com.bigdata.service.AbstractDistributedFederation<T>
com.bigdata.service.jini.JiniFederation<T>
public class JiniFederation<T>
Concrete implementation for Jini.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.bigdata.service.AbstractScaleOutFederation |
|---|
AbstractScaleOutFederation.ForceOverflowTask, AbstractScaleOutFederation.PurgeResourcesTask |
| Nested classes/interfaces inherited from class com.bigdata.service.AbstractFederation |
|---|
AbstractFederation.ReportTask, AbstractFederation.StartDeferredTasksTask |
| Field Summary | |
|---|---|
protected Condition |
discoveryEvent
Condition signaled any time there is a DiscoveryEvent delivered to
our DiscoveryListener. |
protected ReentrantLock |
discoveryEventLock
Lock controlling access to the discoveryEvent Condition. |
| Fields inherited from class com.bigdata.service.AbstractScaleOutFederation |
|---|
metadataIndexCachePolicy |
| Fields inherited from class com.bigdata.service.AbstractFederation |
|---|
log |
| Constructor Summary | |
|---|---|
JiniFederation(JiniClient<T> client,
JiniClientConfig jiniConfig,
ZookeeperClientConfig zooConfig)
Initiates discovery for one or more service registrars and establishes a lookup caches for various bigdata services. |
|
| Method Summary | ||
|---|---|---|
boolean |
awaitJiniRegistrars(long timeout,
TimeUnit unit)
Await at least one jini ServiceRegistrar to be discovered. |
|
void |
cancelMonitoredTasks(boolean mayInterruptIfRunning)
Cancel any monitored tasks which are still running. |
|
void |
createKeyZNodes(org.apache.zookeeper.ZooKeeper zookeeper)
Create key znodes used by the federation. |
|
void |
destroy()
Destroys all discovered services belonging to the federation and their persistent data and disconnects from the federation. |
|
void |
discarded(net.jini.discovery.DiscoveryEvent e)
Signals anyone waiting on discoveryEvent. |
|
void |
discovered(net.jini.discovery.DiscoveryEvent e)
Signals anyone waiting on discoveryEvent. |
|
void |
distributedFederationShutdown(boolean immediateShutdown)
Shutdown the services in the distributed federation NOT just your client. |
|
IDataService |
getAnyDataService()
Return ANY IDataService which has been (or could be) discovered
and which is part of the connected federation. |
|
JiniClient<T> |
getClient()
Return the client object that was used to connect to the federation. |
|
ClientServicesClient |
getClientServicesClient()
Cached lookup for discovered IClientServices. |
|
IDataService |
getDataService(UUID serviceUUID)
Resolve the service identifier to an IDataService. |
|
IDataService |
getDataServiceByName(String name)
Return an IDataService joined with this
IBigdataFederation and having the specified service name. |
|
DataServicesClient |
getDataServicesClient()
Cached lookup for discovered IDataServices and
IMetadataServices. |
|
UUID[] |
getDataServiceUUIDs(int maxCount)
Return an array UUIDs for IDataServices. |
|
net.jini.discovery.LookupDiscoveryManager |
getDiscoveryManagement()
An object used to manage jini service registrar discovery. |
|
protected net.jini.export.Exporter |
getExporter(boolean enableDGC)
Return an Exporter for a single object that implements one or
more Remote interfaces. |
|
long |
getLastCommitTime()
Return the last commit time for the federation (the timestamp of the most recent commit point across all IDataServices). |
|
ILoadBalancerService |
getLoadBalancerService()
Return the load balancer service (or a proxy for that service). |
|
IMetadataService |
getMetadataService()
Return the metadata service (or a proxy for the metadata service). |
|
|
getProxy(E obj,
boolean enableDGC)
Return a proxy for an object. |
|
|
getProxy(Future<E> future)
Note that Futures generated by java.util.concurrent
are NOT Serializable. |
|
|
getProxy(IAsynchronousIterator<E> sourceIterator,
IStreamSerializer<E> serializer,
int capacity)
Export and return a proxy object. |
|
|
getProxy(IBuffer<E> buffer)
A proxy for an IBuffer that does not extend Remote and
which DOES NOT declare that its methods throw IOException (for
RMI). |
|
|
getProxy(IRunnableBuffer<E> buffer)
A proxy for an IRunnableBuffer that does not extend
Remote and which DOES NOT declare that its methods throw
IOException (for RMI). |
|
IResourceLockService |
getResourceLockService()
The service that may be used to acquire synchronous distributed locks without deadlock detection. |
|
net.jini.lookup.ServiceDiscoveryManager |
getServiceDiscoveryManager()
An object used to lookup services using the discovered service registars. |
|
ServicesManagerClient |
getServicesManagerClient()
|
|
ITransactionService |
getTransactionService()
Return the ITransactionService (or a proxy for that service). |
|
ZookeeperClientConfig |
getZooConfig()
Return the zookeeper client configuration. |
|
org.apache.zookeeper.ZooKeeper |
getZookeeper()
Return a ZooKeeper client. |
|
ZooKeeperAccessor |
getZookeeperAccessor()
Return an object that may be used to obtain a ZooKeeper client
and that may be used to obtain the a new ZooKeeper client if the
current session has been expired (an absorbing state for the
ZooKeeper client). |
|
void |
serviceAdded(net.jini.lookup.ServiceDiscoveryEvent e)
Invokes #serviceJoin(com.bigdata.service.IService, UUID, String) |
|
void |
serviceChanged(net.jini.lookup.ServiceDiscoveryEvent e)
NOP. |
|
void |
serviceRemoved(net.jini.lookup.ServiceDiscoveryEvent e)
Invokes AbstractFederation.serviceLeave(UUID) |
|
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). |
|
|
submitMonitoredTask(Callable<T1> task)
Submits the task for execution and monitors its Future. |
|
| Methods inherited from class com.bigdata.service.AbstractDistributedFederation |
|---|
isDistributed, isStable |
| Methods inherited from class com.bigdata.service.AbstractScaleOutFederation |
|---|
awaitServices, forceOverflow, getIndex, getIndexCache, getMetadataIndex, getMetadataIndexCache, isScaleOut, locatorScan |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final ReentrantLock discoveryEventLock
discoveryEvent Condition.
protected final Condition discoveryEvent
DiscoveryEvent delivered to
our DiscoveryListener.
| Constructor Detail |
|---|
public JiniFederation(JiniClient<T> client,
JiniClientConfig jiniConfig,
ZookeeperClientConfig zooConfig)
client - The client.| Method Detail |
|---|
public ZookeeperClientConfig getZooConfig()
public ZooKeeperAccessor getZookeeperAccessor()
ZooKeeper client
and that may be used to obtain the a new ZooKeeper client if the
current session has been expired (an absorbing state for the
ZooKeeper client).
public org.apache.zookeeper.ZooKeeper getZookeeper()
ZooKeeper client.
Note: This is a shorthand for obtaining a valid ZooKeeper client
from the ZooKeeperAccessor. If the session associated with the
current ZooKeeper client is expired, then a distinct
ZooKeeper client associated with a distinct session will be
returned. See getZookeeperAccessor() which lets you explicitly
handle a KeeperException.SessionExpiredException or the ZooKeeper
ZooKeeper.States#CLOSED state.
getZookeeperAccessor()
public void createKeyZNodes(org.apache.zookeeper.ZooKeeper zookeeper)
throws org.apache.zookeeper.KeeperException,
InterruptedException
org.apache.zookeeper.KeeperException
InterruptedExceptionpublic net.jini.discovery.LookupDiscoveryManager getDiscoveryManagement()
public net.jini.lookup.ServiceDiscoveryManager getServiceDiscoveryManager()
public DataServicesClient getDataServicesClient()
IDataServices and
IMetadataServices. Will block on a cache miss and attempt to
discover an appropriate service instance.
public ServicesManagerClient getServicesManagerClient()
public ClientServicesClient getClientServicesClient()
IClientServices.
public boolean awaitJiniRegistrars(long timeout,
TimeUnit unit)
throws InterruptedException
ServiceRegistrar to be discovered.
timeout - unit -
true at least one registrar was available before
the timeout.
InterruptedException - if interrupted awaiting a jini ServiceRegistrar to be
discovered.public JiniClient<T> getClient()
IBigdataFederation
getClient in interface IBigdataFederation<T>getClient in class AbstractFederation<T>public ILoadBalancerService getLoadBalancerService()
IBigdataFederation
getLoadBalancerService in interface IBigdataFederation<T>null if the service has not been discovered.public ITransactionService getTransactionService()
IBigdataFederationITransactionService (or a proxy for that service).
getTransactionService in interface IBigdataFederation<T>null if the service has not been
discovered.public IResourceLockService getResourceLockService()
IIndexStore
getResourceLockService in interface IIndexStorepublic IMetadataService getMetadataService()
IBigdataFederation
getMetadataService in interface IBigdataFederation<T>null if the service has not been discovered.public UUID[] getDataServiceUUIDs(int maxCount)
IBigdataFederationIDataServices.
getDataServiceUUIDs in interface IBigdataFederation<T>maxCount - The maximum #of data services whose UUIDs will be returned.
When zero (0) the UUID for all known data services will be
returned.
UUIDs for data services.public IDataService getDataService(UUID serviceUUID)
IBigdataFederationIDataService.
Note: Whether the returned object is a proxy or the service implementation depends on whether the federation is embedded (in process) or distributed (networked).
getDataService in interface IBigdataFederation<T>serviceUUID - The identifier for a IDataService.
IDataService or null iff the
IDataService could not be discovered from its identifier.public IDataService getAnyDataService()
IBigdataFederationIDataService which has been (or could be) discovered
and which is part of the connected federation.
Note: This method is here as a failsafe when the
ILoadBalancerService is not available.
getAnyDataService in interface IBigdataFederation<T>null if there are NO known IDataServices.public IDataService getDataServiceByName(String name)
IBigdataFederationIDataService joined with this
IBigdataFederation and having the specified service name.
Services that are not joined will not be discovered.
Note: At least some service fabrics (such as jini) do not enforce a
uniqueness constraint on the service name(s). In such cases an arbitrary
IDataService method the other requirements will be returned. It
is the responsibility of the administrator to ensure that each
IDataService is assigned a distinct service name.
getDataServiceByName in interface IBigdataFederation<T>name - The service name.
null if none is
joined with the IBigdataFederation at this time.public void shutdown()
AbstractFederationNote: concrete implementations MUST extend this method.
Note: Clients use IBigdataClient.disconnect(boolean) to
disconnect from a federation. The federation implements that disconnect
using either AbstractFederation.shutdown() or AbstractFederation.shutdownNow().
The implementation must be a NOP if the federation is already shutdown.
shutdown in class AbstractScaleOutFederation<T>public void shutdownNow()
AbstractFederation
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
AbstractFederation.shutdown() or AbstractFederation.shutdownNow().
The implementation must be a NOP if the federation is already shutdown.
shutdownNow in class AbstractScaleOutFederation<T>
public void distributedFederationShutdown(boolean immediateShutdown)
throws InterruptedException
shutdown() or shutdownNow() instead.
The shutdown protocol is as follows:
ITransactionService (blocks until shutdown).IDataServices (blocks until all are shutdown).IMetadataServiceILoadBalancerService
immediateShutdown - When true the services will be shutdown without
waiting for existing transactions and other tasks to
terminate.
InterruptedExceptionpublic void destroy()
IBigdataFederation
destroy in interface IIndexStoredestroy in interface IBigdataFederation<T>destroy in class AbstractFederation<T>public long getLastCommitTime()
IBigdataFederationIDataServices).
This is useful for ITx.READ_COMMITTED operations that need to use
a consistent timestamp across a series of DataServices or a
series of requests against a single DataService that must use a
consistent view.
getLastCommitTime in interface IIndexStoregetLastCommitTime in interface IBigdataFederation<T>IRootBlockView.getLastCommitTime()protected net.jini.export.Exporter getExporter(boolean enableDGC)
Exporter for a single object that implements one or
more Remote interfaces.
Note: This uses TCP Server sockets.
Note: This uses [port := 0], which means a random port is assigned.
Note: The VM WILL NOT be kept alive by the exported proxy (keepAlive is
false).
enableDGC - if distributed garbage collection should be used for the
object to be exported.
Exporter.
public <E> IAsynchronousIterator<E> getProxy(IAsynchronousIterator<E> sourceIterator,
IStreamSerializer<E> serializer,
int capacity)
Note: This is used for query evaluation in which there is at least one
JOIN. It DOES NOT get used for simple IAccessPath scans. Those
use IRangeQuery.rangeIterator() instead.
getProxy in class AbstractDistributedFederation<T>sourceIterator - The source iterator. Note that the iterator normally visits
elements of some array type (chunks).serializer - The object responsible for (de-)serializing a chunk of
elements visited by the iterator.capacity - The capacity for the internal buffer that is used to
asynchronously transfer elements (chunks) from the remote
iterator to the client iterator.
IAsynchronousIterator.Configuration of the Exporter for the proxy
iterators and futures.
Since the Exporter is paired to a single object the
configuration of the Exporter will require an additional
level of indirection when compared to the Configuration of
an AbstractServer's Exporter.
public <E> Future<E> getProxy(Future<E> future)
Futures generated by java.util.concurrent
are NOT Serializable. Futher note the proxy as generated by an
Exporter MUST be encapsulated so that the object returned to the
caller can implement Future without having to declare that the
methods throw IOException (for RMI).
getProxy in class AbstractDistributedFederation<T>future - The future.
Future that masquerades any RMI
exceptions.public <E> IBuffer<E> getProxy(IBuffer<E> buffer)
IBuffer that does not extend Remote and
which DOES NOT declare that its methods throw IOException (for
RMI).
getProxy in class AbstractDistributedFederation<T>buffer - The buffer.
IBuffer that masquerades any RMI
exceptions.public <E,V> IRunnableBuffer<E> getProxy(IRunnableBuffer<E> buffer)
IRunnableBuffer that does not extend
Remote and which DOES NOT declare that its methods throw
IOException (for RMI).
buffer - The buffer.
IBuffer that masquerades any RMI
exceptions.
public <E> E getProxy(E obj,
boolean enableDGC)
AbstractDistributedFederation
getProxy in class AbstractDistributedFederation<T>obj - The object.enableDGC - If distributed garbage collection should be used for the
object.
public void serviceAdded(net.jini.lookup.ServiceDiscoveryEvent e)
#serviceJoin(com.bigdata.service.IService, UUID, String)
serviceAdded in interface net.jini.lookup.ServiceDiscoveryListenerpublic void serviceChanged(net.jini.lookup.ServiceDiscoveryEvent e)
serviceChanged in interface net.jini.lookup.ServiceDiscoveryListenerpublic void serviceRemoved(net.jini.lookup.ServiceDiscoveryEvent e)
AbstractFederation.serviceLeave(UUID)
serviceRemoved in interface net.jini.lookup.ServiceDiscoveryListenerpublic void discarded(net.jini.discovery.DiscoveryEvent e)
discoveryEvent.
discarded in interface net.jini.discovery.DiscoveryListenerpublic void discovered(net.jini.discovery.DiscoveryEvent e)
discoveryEvent.
discovered in interface net.jini.discovery.DiscoveryListenerpublic <T1> Future<T1> submitMonitoredTask(Callable<T1> task)
Future.
task - The task.
Future.AbstractFederation?public void cancelMonitoredTasks(boolean mayInterruptIfRunning)
mayInterruptIfRunning -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||