Class ServiceHandler
- java.lang.Object
- 
- jadex.platform.service.servicepool.ServiceHandler
 
- 
- All Implemented Interfaces:
- java.lang.reflect.InvocationHandler
 
 public class ServiceHandler extends java.lang.Object implements java.lang.reflect.InvocationHandlerThe service handler is used as service implementation for proxy services. Incoming calls will be served by instances from the pool.
- 
- 
Field SummaryFields Modifier and Type Field Description protected java.util.Set<IService>allservicesAll services.protected IClockServiceclockThe clock service.protected IInternalAccesscomponentThe component.protected java.lang.StringcomponentnameThe worker component name.protected java.util.Map<IService,ITimer>idleservicesMap of idle services.protected CreationInfoinfoThe creation info.protected java.util.List<java.lang.Object[]>queueA queue of open requests.protected java.lang.Class<?>servicetypeThe service type.protected IPoolStrategystrategyThe strategy.
 - 
Constructor SummaryConstructors Constructor Description ServiceHandler(IInternalAccess component, java.lang.Class<?> servicetype, IPoolStrategy strategy, java.lang.String componentname, CreationInfo info)Create a new service handler.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddFreeService(IService service)Called when a service becomes idle.protected IFuture<IService>createService()protected IFuture<ITimer>createTimer(long delay, ITimedObject to)Create a timer via the clock service.protected IFuture<IClockService>getClockService()Get the clockservice (cached).IFuture<java.lang.Void>init()Init.java.lang.Objectinvoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)Callback of the invocation handler interface.protected voidinvokeService(IService service, java.lang.reflect.Method method, java.lang.Object[] args, Future<?> ret, ServiceCall call)Execute a task on a service.protected IFuture<java.lang.Void>removeService(IService service)Remove a service and the worker.java.lang.StringtoString()Get the string representation.protected IFuture<java.lang.Void>updateWorkerTimer(IService service)Update the worker timer by: - creating a timer (if timeout) - updating the service pool entry for the service (service, timer)
 
- 
- 
- 
Field Detail- 
componentprotected IInternalAccess component The component.
 - 
servicetypeprotected java.lang.Class<?> servicetype The service type.
 - 
allservicesprotected java.util.Set<IService> allservices All services.
 - 
queueprotected java.util.List<java.lang.Object[]> queue A queue of open requests.
 - 
strategyprotected IPoolStrategy strategy The strategy.
 - 
componentnameprotected java.lang.String componentname The worker component name.
 - 
clockprotected IClockService clock The clock service.
 - 
infoprotected CreationInfo info The creation info.
 
- 
 - 
Constructor Detail- 
ServiceHandlerpublic ServiceHandler(IInternalAccess component, java.lang.Class<?> servicetype, IPoolStrategy strategy, java.lang.String componentname, CreationInfo info) Create a new service handler.
 
- 
 - 
Method Detail- 
initpublic IFuture<java.lang.Void> init() Init.
 - 
invokepublic java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.ThrowableCallback of the invocation handler interface.- Specified by:
- invokein interface- java.lang.reflect.InvocationHandler
- Throws:
- java.lang.Throwable
 
 - 
addFreeServiceprotected void addFreeService(IService service) Called when a service becomes idle.
 - 
updateWorkerTimerprotected IFuture<java.lang.Void> updateWorkerTimer(IService service) Update the worker timer by: - creating a timer (if timeout) - updating the service pool entry for the service (service, timer)
 - 
invokeServiceprotected void invokeService(IService service, java.lang.reflect.Method method, java.lang.Object[] args, Future<?> ret, ServiceCall call) Execute a task on a service.
 - 
removeServiceprotected IFuture<java.lang.Void> removeService(IService service) Remove a service and the worker.
 - 
getClockServiceprotected IFuture<IClockService> getClockService() Get the clockservice (cached).
 - 
createTimerprotected IFuture<ITimer> createTimer(long delay, ITimedObject to) Create a timer via the clock service.
 - 
toStringpublic java.lang.String toString() Get the string representation.- Overrides:
- toStringin class- java.lang.Object
 
 
- 
 
-