Package dagger.producers.monitoring
Class ProductionComponentMonitor
- java.lang.Object
-
- dagger.producers.monitoring.ProductionComponentMonitor
-
- Direct Known Subclasses:
TimingProductionComponentMonitor
public abstract class ProductionComponentMonitor extends java.lang.Object
A hook for monitoring execution of production components. To install aProductionComponentMonitor
, contribute to a set binding ofProductionComponentMonitor.Factory
. The factory will be asked to create one monitor for the component, and the resulting single instance will be used to create individual monitors for producers.For example:
@Module final class MyMonitorModule { @Provides @IntoSet ProductionComponentMonitor.Factory provideMonitorFactory( MyProductionComponentMonitor.Factory monitorFactory) { return monitorFactory; } } @ProductionComponent(modules = {MyMonitorModule.class, MyProducerModule.class}) interface MyComponent { ListenableFuture<SomeType> someType(); }
If any of these methods throw, then the exception will be logged, and the framework will act as though a no-op monitor was returned.
- Since:
- 2.1
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ProductionComponentMonitor.Factory
-
Constructor Summary
Constructors Constructor Description ProductionComponentMonitor()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static ProductionComponentMonitor
noOp()
Returns a monitor that does no monitoring.abstract ProducerMonitor
producerMonitorFor​(ProducerToken token)
Returns a monitor for an individual producer method.
-
-
-
Method Detail
-
producerMonitorFor
public abstract ProducerMonitor producerMonitorFor​(ProducerToken token)
Returns a monitor for an individual producer method.
-
noOp
public static ProductionComponentMonitor noOp()
Returns a monitor that does no monitoring.
-
-