Class GlobalPoolServiceManager
- java.lang.Object
-
- jadex.platform.service.globalservicepool.GlobalPoolServiceManager
-
public class GlobalPoolServiceManager extends java.lang.Object
The pool manager handles the pool resources. It implements the getPoolServices() method to deliver workers to the intelligent proxy. Creates new workers on free platforms if needed. todo: remove unused workers after some timeout
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GlobalPoolServiceManager.PlatformInfo
-
Field Summary
Fields Modifier and Type Field Description protected IInternalAccess
component
The component.protected java.lang.String
componentname
The worker component name.protected java.util.Map<IComponentIdentifier,ILibraryService>
freeplatforms
The current set of free platforms.protected CreationInfo
info
The creation info for the workers.protected java.util.Map<IServiceIdentifier,IService>
onholds
The services on hold (reported to be broken by proxies).protected java.util.Map<IComponentIdentifier,GlobalPoolServiceManager.PlatformInfo>
platforms
The current set of platforms.protected java.util.Map<IServiceIdentifier,IService>
services
All services.protected java.lang.Class<?>
servicetype
The service type.protected IGlobalPoolStrategy
strategy
The strategy.protected java.util.Map<IServiceIdentifier,ITimer>
timers
The worker timers.protected java.util.Map<IServiceIdentifier,UsageInfo>
usages
The latest usage infos per worker (service id).
-
Constructor Summary
Constructors Constructor Description GlobalPoolServiceManager(IInternalAccess component, java.lang.Class<?> servicetype, java.lang.String componentname, CreationInfo info, IGlobalPoolStrategy strategy)
Create a new service handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IFuture<java.lang.Void>
addUsageInfo(java.util.Map<IServiceIdentifier,UsageInfo> infos)
Add service usages.protected IIntermediateFuture<IService>
createServices(int n)
Create a service on some platform.protected IFuture<ITimer>
createTimer(long delay, ITimedObject to)
Create a timer via the clock service.protected ITerminableIntermediateFuture<ILibraryService>
getFreePlatforms()
Get all free platforms.protected ITerminableIntermediateFuture<ILibraryService>
getPlatforms()
Get all available platforms for workers.IIntermediateFuture<IService>
getPoolServices(java.lang.Class<?> type, java.util.Set<IServiceIdentifier> brokens)
Proxies call this method to get services (workers) from the pool.protected IFuture<java.lang.Void>
removeService(IServiceIdentifier sid)
Remove a service and the worker.protected void
updateServiceAdded(IService ser)
protected void
updateServiceRemoved(IServiceIdentifier sid)
protected IFuture<java.lang.Void>
updateWorkerTimer(IServiceIdentifier sid)
Update the worker timer by: - creating a timer (if timeout) - updating the service pool entry for the service (service, timer)
-
-
-
Field Detail
-
services
protected java.util.Map<IServiceIdentifier,IService> services
All services.
-
onholds
protected java.util.Map<IServiceIdentifier,IService> onholds
The services on hold (reported to be broken by proxies).
-
timers
protected java.util.Map<IServiceIdentifier,ITimer> timers
The worker timers.
-
platforms
protected java.util.Map<IComponentIdentifier,GlobalPoolServiceManager.PlatformInfo> platforms
The current set of platforms.
-
freeplatforms
protected java.util.Map<IComponentIdentifier,ILibraryService> freeplatforms
The current set of free platforms.
-
component
protected IInternalAccess component
The component.
-
servicetype
protected java.lang.Class<?> servicetype
The service type.
-
componentname
protected java.lang.String componentname
The worker component name.
-
info
protected CreationInfo info
The creation info for the workers.
-
usages
protected java.util.Map<IServiceIdentifier,UsageInfo> usages
The latest usage infos per worker (service id).
-
strategy
protected IGlobalPoolStrategy strategy
The strategy.
-
-
Constructor Detail
-
GlobalPoolServiceManager
public GlobalPoolServiceManager(IInternalAccess component, java.lang.Class<?> servicetype, java.lang.String componentname, CreationInfo info, IGlobalPoolStrategy strategy)
Create a new service handler.
-
-
Method Detail
-
getPoolServices
public IIntermediateFuture<IService> getPoolServices(java.lang.Class<?> type, java.util.Set<IServiceIdentifier> brokens)
Proxies call this method to get services (workers) from the pool. Get a set of services managed by the pool.- Parameters:
type
- The service type.- Returns:
- A number of services from the pool.
-
addUsageInfo
public IFuture<java.lang.Void> addUsageInfo(java.util.Map<IServiceIdentifier,UsageInfo> infos)
Add service usages.- Parameters:
The
- usage infos per service class.
-
getPlatforms
protected ITerminableIntermediateFuture<ILibraryService> getPlatforms()
Get all available platforms for workers. (Excludes the own platforms because global pool already provides workers)
-
getFreePlatforms
protected ITerminableIntermediateFuture<ILibraryService> getFreePlatforms()
Get all free platforms. A free platform is a platform on which no worker of this pool has been started.
-
createServices
protected IIntermediateFuture<IService> createServices(int n)
Create a service on some platform.
-
updateWorkerTimer
protected IFuture<java.lang.Void> updateWorkerTimer(IServiceIdentifier sid)
Update the worker timer by: - creating a timer (if timeout) - updating the service pool entry for the service (service, timer)
-
removeService
protected IFuture<java.lang.Void> removeService(IServiceIdentifier sid)
Remove a service and the worker.
-
updateServiceAdded
protected void updateServiceAdded(IService ser)
-
updateServiceRemoved
protected void updateServiceRemoved(IServiceIdentifier sid)
-
createTimer
protected IFuture<ITimer> createTimer(long delay, ITimedObject to)
Create a timer via the clock service.
-
-