@Singleton public class BaseMonitoringService extends Object implements MonitoringService
Modifier and Type | Field and Description |
---|---|
protected RestContext<AbiquoApi,AbiquoAsyncApi> |
context |
protected com.google.common.eventbus.EventBus |
eventBus
The event bus used to dispatch monitoring events.
|
protected Long |
pollingDelay |
protected ScheduledExecutorService |
scheduler
The scheduler used to perform monitoring tasks.
|
Constructor and Description |
---|
BaseMonitoringService(RestContext<AbiquoApi,AbiquoAsyncApi> context,
ScheduledExecutorService scheduler,
Long pollingDelay,
com.google.common.eventbus.EventBus eventBus) |
Modifier and Type | Method and Description |
---|---|
<T> void |
awaitCompletion(com.google.common.base.Function<T,MonitorStatus> completeCondition,
T... objects)
Generic monitoring methods
|
<T> void |
awaitCompletion(Long maxWait,
TimeUnit timeUnit,
com.google.common.base.Function<T,MonitorStatus> completeCondition,
T... objects)
Monitor the given objects using the given complete condition.
|
AsyncTaskMonitor |
getAsyncTaskMonitor()
Gets the asynchronous task monitor service.
|
ConversionMonitor |
getConversionMonitor()
Gets the conversion monitor service.
|
VirtualApplianceMonitor |
getVirtualApplianceMonitor()
Gets the virtual appliance monitor service.
|
VirtualMachineMonitor |
getVirtualMachineMonitor()
Delegating monitors
|
<T> void |
monitor(com.google.common.base.Function<T,MonitorStatus> completeCondition,
T... objects)
Monitor the given objects using the given complete condition.
|
<T> void |
monitor(Long maxWait,
TimeUnit timeUnit,
com.google.common.base.Function<T,MonitorStatus> completeCondition,
T... objects)
Monitor the given objects using the given complete condition.
|
<T extends AbstractEventHandler<?>> |
register(T handler)
Registers the given event handler.
|
<T extends AbstractEventHandler<?>> |
unregister(T handler)
Unregisters the given event handler.
|
protected RestContext<AbiquoApi,AbiquoAsyncApi> context
protected ScheduledExecutorService scheduler
protected Long pollingDelay
protected com.google.common.eventbus.EventBus eventBus
A sync bus is used by default, to prevent deadlocks when using the
BlockingEventHandler
.
@Inject public BaseMonitoringService(RestContext<AbiquoApi,AbiquoAsyncApi> context, @Named(value="jclouds.scheduler-threads") ScheduledExecutorService scheduler, @Named(value="abiquo.monitor-delay") Long pollingDelay, com.google.common.eventbus.EventBus eventBus)
public <T> void awaitCompletion(com.google.common.base.Function<T,MonitorStatus> completeCondition, T... objects)
awaitCompletion
in interface MonitoringService
completeCondition
- The function that will be used to decide if the asynchronous
operations have finished.objects
- The objects to monitor.public <T> void awaitCompletion(Long maxWait, TimeUnit timeUnit, com.google.common.base.Function<T,MonitorStatus> completeCondition, T... objects)
MonitoringService
awaitCompletion
in interface MonitoringService
maxWait
- The maximum time to wait.timeUnit
- The time unit for the maxWait parameter.completeCondition
- The function that will be used to decide if the asynchronous
operations have finished.objects
- The objects to monitor.public <T> void monitor(com.google.common.base.Function<T,MonitorStatus> completeCondition, T... objects)
MonitoringService
monitor
in interface MonitoringService
completeCondition
- The function that will be used to decide if the asynchronous
operations have finished.objects
- The objects to monitor.public <T> void monitor(Long maxWait, TimeUnit timeUnit, com.google.common.base.Function<T,MonitorStatus> completeCondition, T... objects)
MonitoringService
monitor
in interface MonitoringService
maxWait
- The maximum time to wait.timeUnit
- The time unit for the maxWait parameter.completeCondition
- The function that will be used to decide if the asynchronous
operations have finished.objects
- The objects to monitor.public <T extends AbstractEventHandler<?>> void register(T handler)
MonitoringService
register
in interface MonitoringService
T
- The type of event handler to register.handler
- The event handler to register.public <T extends AbstractEventHandler<?>> void unregister(T handler)
MonitoringService
unregister
in interface MonitoringService
T
- The type of event handler to unregister.handler
- The event handler to unregister.public VirtualMachineMonitor getVirtualMachineMonitor()
getVirtualMachineMonitor
in interface MonitoringService
public VirtualApplianceMonitor getVirtualApplianceMonitor()
MonitoringService
getVirtualApplianceMonitor
in interface MonitoringService
public AsyncTaskMonitor getAsyncTaskMonitor()
MonitoringService
getAsyncTaskMonitor
in interface MonitoringService
public ConversionMonitor getConversionMonitor()
MonitoringService
getConversionMonitor
in interface MonitoringService
Copyright © 2009-2013 jclouds. All Rights Reserved.