com.bigdata.service
Class DefaultServiceFederationDelegate<T extends AbstractService>

java.lang.Object
  extended by com.bigdata.service.DefaultServiceFederationDelegate<T>
All Implemented Interfaces:
IFederationDelegate<T>
Direct Known Subclasses:
ClientService.ClientServiceFederationDelegate, DataService.DataServiceFederationDelegate, TransactionServer.TransactionServiceFederationDelegate

public class DefaultServiceFederationDelegate<T extends AbstractService>
extends Object
implements IFederationDelegate<T>

Basic delegate for services that need to override the service UUID and service interface reported to the ILoadBalancerService.

Version:
$Id: DefaultServiceFederationDelegate.java 5879 2012-01-25 17:02:42Z thompsonbry $
Author:
Bryan Thompson

Field Summary
protected static org.apache.log4j.Logger log
           
protected  T service
           
 
Constructor Summary
DefaultServiceFederationDelegate(T service)
           
 
Method Summary
 void didStart()
          NOP
 T getService()
          Return the client or service.
 Class getServiceIface()
          Return the class or interface that is the most interesting facet of the client and which will be used to identify this client in the performance counters reported to the ILoadBalancerService.
 String getServiceName()
          Return a name for the service.
 UUID getServiceUUID()
          The UUID assigned to the IBigdataClient or AbstractService.
 boolean isServiceReady()
          Returns true
protected  void logHttpdURL(File file)
          Writes the URL of the local httpd service for the DataService onto a file named httpd.url in the specified directory.
 AbstractHTTPD newHttpd(int httpdPort, ICounterSetAccess access)
          Create a new AbstractHTTPD instance.
 void reattachDynamicCounters()
          Offers the service an opportunity to dynamically detach and re-attach performance counters.
 void serviceJoin(IService service, UUID serviceUUID)
          NOP
 void serviceLeave(UUID serviceUUID)
          NOP
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.log4j.Logger log

service

protected final T extends AbstractService service
Constructor Detail

DefaultServiceFederationDelegate

public DefaultServiceFederationDelegate(T service)
Method Detail

getService

public T getService()
Description copied from interface: IFederationDelegate
Return the client or service.

Specified by:
getService in interface IFederationDelegate<T extends AbstractService>

getServiceName

public String getServiceName()
Description copied from interface: IFederationDelegate
Return a name for the service. It is up to administrators to ensure that service names are unique.

Specified by:
getServiceName in interface IFederationDelegate<T extends AbstractService>
Returns:
A name for the service.

getServiceUUID

public UUID getServiceUUID()
Description copied from interface: IFederationDelegate
The UUID assigned to the IBigdataClient or AbstractService.

Specified by:
getServiceUUID in interface IFederationDelegate<T extends AbstractService>
See Also:
AbstractService.setServiceUUID(UUID)

getServiceIface

public Class getServiceIface()
Description copied from interface: IFederationDelegate
Return the class or interface that is the most interesting facet of the client and which will be used to identify this client in the performance counters reported to the ILoadBalancerService.

Specified by:
getServiceIface in interface IFederationDelegate<T extends AbstractService>
Returns:
The class or interface and never null.

reattachDynamicCounters

public void reattachDynamicCounters()
Description copied from interface: IFederationDelegate
Offers the service an opportunity to dynamically detach and re-attach performance counters. This can be invoked either in response to an http GET or the periodic reporting of performance counters to the ILoadBalancerService. In general, implementations should limit the frequency of update, e.g., to no more than once a second.

Note: For most purposes, this has been replaced by ICounterSetAccess which is now passed into CounterSetHTTPD. That provides the necessary indirection for periodic refresh of the performance counters. The CounterSetHTTPD now also handles the limitation on the update frequency for the materialized counters.

However, there are still some counters which need to be dynamically reattached. For example, any counter set which is dynamic in its structure, such as the DirectBufferPool.

Specified by:
reattachDynamicCounters in interface IFederationDelegate<T extends AbstractService>

isServiceReady

public boolean isServiceReady()
Returns true

Specified by:
isServiceReady in interface IFederationDelegate<T extends AbstractService>

didStart

public void didStart()
NOP

Specified by:
didStart in interface IFederationDelegate<T extends AbstractService>

serviceJoin

public void serviceJoin(IService service,
                        UUID serviceUUID)
NOP

Specified by:
serviceJoin in interface IFederationDelegate<T extends AbstractService>
Parameters:
service - The service.
serviceUUID - The service UUID.

serviceLeave

public void serviceLeave(UUID serviceUUID)
NOP

Specified by:
serviceLeave in interface IFederationDelegate<T extends AbstractService>
Parameters:
serviceUUID - The service UUID.

newHttpd

public AbstractHTTPD newHttpd(int httpdPort,
                              ICounterSetAccess access)
                       throws IOException
Description copied from interface: IFederationDelegate
Create a new AbstractHTTPD instance.

Specified by:
newHttpd in interface IFederationDelegate<T extends AbstractService>
access - Used to materialize the CounterSet that will be served up.
Returns:
The httpd daemon.
Throws:
IOException

logHttpdURL

protected void logHttpdURL(File file)
Writes the URL of the local httpd service for the DataService onto a file named httpd.url in the specified directory.



Copyright © 2006-2011 SYSTAP, LLC. All Rights Reserved.