Class CamelContextTracker
java.lang.Object
org.apache.camel.spi.CamelContextTracker
- All Implemented Interfaces:
Closeable, AutoCloseable
Tracks the creation and destruction of
CamelContext instances across the JVM.
A tracker is activated by calling open() (and deactivated via close()); while open it is notified
through contextCreated(CamelContext) and contextDestroyed(CamelContext) for every context that
passes its CamelContextTracker.Filter (by default, non-proxy contexts). Registration is global and static, making this suited to
cross-cutting concerns such as metrics or diagnostics that must observe all contexts rather than a single
CamelContext. Subclass and override the callbacks to react.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceDecides whichCamelContextinstances aCamelContextTrackeris notified about. -
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionbooleanaccept(CamelContext camelContext) Called to determine whether this tracker should accept the given context.final voidclose()Closes the tracker so it not longer tracks.voidcontextCreated(CamelContext camelContext) Called when a context is created.voidcontextDestroyed(CamelContext camelContext) Called when a context has been shutdown.static voidnotifyContextCreated(CamelContext camelContext) Notifies all open trackers that the givenCamelContexthas been created.static voidnotifyContextDestroyed(CamelContext camelContext) Notifies all open trackers that the givenCamelContexthas been destroyed.final voidopen()Opens the tracker to start tracking when newCamelContextis created or destroyed.
-
Constructor Details
-
CamelContextTracker
public CamelContextTracker() -
CamelContextTracker
-
-
Method Details
-
accept
Called to determine whether this tracker should accept the given context. -
contextCreated
Called when a context is created. -
contextDestroyed
Called when a context has been shutdown. -
open
public final void open()Opens the tracker to start tracking when newCamelContextis created or destroyed. -
close
public final void close()Closes the tracker so it not longer tracks.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
notifyContextCreated
Notifies all open trackers that the givenCamelContexthas been created. Called by Camel; exceptions from trackers are logged and ignored.- Parameters:
camelContext- the created camel context
-
notifyContextDestroyed
Notifies all open trackers that the givenCamelContexthas been destroyed. Called by Camel; exceptions from trackers are logged and ignored.- Parameters:
camelContext- the destroyed camel context
-