Package ru.vyarus.dropwizard.guice.debug
Class LifecycleDiagnostic
- java.lang.Object
-
- ru.vyarus.dropwizard.guice.module.lifecycle.GuiceyLifecycleAdapter
-
- ru.vyarus.dropwizard.guice.module.lifecycle.UniqueGuiceyLifecycleListener
-
- ru.vyarus.dropwizard.guice.debug.LifecycleDiagnostic
-
- All Implemented Interfaces:
GuiceyLifecycleListener
public class LifecycleDiagnostic extends UniqueGuiceyLifecycleListener
Debug guicey lifecycle listener. Could be installed with bundle shortcut:GuiceBundle.Builder.printLifecyclePhases()
.Use system out instead of logger because logger in not initialized in time of first events and for more clarity.
Split logs with current phase name and startup timer. This should clarify custom logic execution times.
If multiple listeners registered, only first registered will be actually used (allow safe multiple registrations).
- Since:
- 17.04.2018
-
-
Constructor Summary
Constructors Constructor Description LifecycleDiagnostic(boolean showDetails)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
applicationRun(ApplicationRunEvent event)
Called afterGuiceBundle.run(io.dropwizard.Configuration, io.dropwizard.setup.Environment)
when guicey context is started, extensions installed (but not hk extensions, because neither jersey nor jetty isn't start yet).protected void
bundlesInitialized(BundlesInitializedEvent event)
Called after bundles initialization.protected void
bundlesStarted(BundlesStartedEvent event)
Called after bundles start (run method call).protected void
classpathExtensionsResolved(ClasspathExtensionsResolvedEvent event)
Called when classes from classpath scan analyzed and all extensions detected.protected void
commandsResolved(CommandsResolvedEvent event)
Called if commands search is enabled (GuiceBundle.Builder.searchCommands()
) and at least one command found.protected void
configurationHooksProcessed(ConfigurationHooksProcessedEvent event)
Appeared just in time ofGuiceBundle.Builder.build()
after manual builder configuration and allGuiceyConfigurationHook
processing.protected void
dropwizardBundlesInitialized(DropwizardBundlesInitializedEvent event)
Called after dropwizard bundles initialization (for dropwizard bundles registered through guicey api).protected void
extensionsInstalled(ExtensionsInstalledEvent event)
Called after all installers install related extensions.protected void
extensionsResolved(ExtensionsResolvedEvent event)
Called when all extensions detected (from classpath scan and guice modules).protected void
injectorCreation(InjectorCreationEvent event)
Called just before guice injector creation.protected void
installersResolved(InstallersResolvedEvent event)
Called after all installers resolved (including installers found with classpath scan) and prepared for processing extensions.protected void
jerseyConfiguration(JerseyConfigurationEvent event)
Jersey context starting.protected void
jerseyExtensionsInstalled(JerseyExtensionsInstalledEvent event)
Called after allJerseyInstaller
installers install related extensions and only when at least one extension was installed.protected void
lookupBundlesResolved(BundlesFromLookupResolvedEvent event)
Called if at least one bundle recognized using bundles lookup.protected void
manualExtensionsValidated(ManualExtensionsValidatedEvent event)
Called when all manually registered extension classes are recognized by installers (validated).protected void
modulesAnalyzed(ModulesAnalyzedEvent event)
Called when guice bindings analyzed and all extensions detected.-
Methods inherited from class ru.vyarus.dropwizard.guice.module.lifecycle.UniqueGuiceyLifecycleListener
equals, hashCode
-
Methods inherited from class ru.vyarus.dropwizard.guice.module.lifecycle.GuiceyLifecycleAdapter
applicationShutdown, applicationStarted, applicationStopped, beforeRun, bundlesResolved, extensionsInstalledBy, initialized, jerseyExtensionsInstalledBy, onEvent
-
-
-
-
Method Detail
-
configurationHooksProcessed
protected void configurationHooksProcessed(ConfigurationHooksProcessedEvent event)
Description copied from class:GuiceyLifecycleAdapter
Appeared just in time ofGuiceBundle.Builder.build()
after manual builder configuration and allGuiceyConfigurationHook
processing. Not called when no hooks were used.- Overrides:
configurationHooksProcessed
in classGuiceyLifecycleAdapter
- Parameters:
event
- event object- See Also:
GuiceyLifecycle.ConfigurationHooksProcessed
-
dropwizardBundlesInitialized
protected void dropwizardBundlesInitialized(DropwizardBundlesInitializedEvent event)
Description copied from class:GuiceyLifecycleAdapter
Called after dropwizard bundles initialization (for dropwizard bundles registered through guicey api). Not called if no bundles were registered.- Overrides:
dropwizardBundlesInitialized
in classGuiceyLifecycleAdapter
- Parameters:
event
- event object- See Also:
GuiceyLifecycle.DropwizardBundlesInitialized
-
lookupBundlesResolved
protected void lookupBundlesResolved(BundlesFromLookupResolvedEvent event)
Description copied from class:GuiceyLifecycleAdapter
Called if at least one bundle recognized using bundles lookup. Not called at if nothing found.- Overrides:
lookupBundlesResolved
in classGuiceyLifecycleAdapter
- Parameters:
event
- event object- See Also:
GuiceyLifecycle.BundlesFromLookupResolved
-
bundlesInitialized
protected void bundlesInitialized(BundlesInitializedEvent event)
Description copied from class:GuiceyLifecycleAdapter
Called after bundles initialization. Note that bundles could register other bundles and so resulted list of installed bundles could be bigger (than in resolution event).- Overrides:
bundlesInitialized
in classGuiceyLifecycleAdapter
- Parameters:
event
- event object- See Also:
GuiceyLifecycle.BundlesInitialized
-
commandsResolved
protected void commandsResolved(CommandsResolvedEvent event)
Description copied from class:GuiceyLifecycleAdapter
Called if commands search is enabled (GuiceBundle.Builder.searchCommands()
) and at least one command found. Not called otherwise.- Overrides:
commandsResolved
in classGuiceyLifecycleAdapter
- Parameters:
event
- event object- See Also:
GuiceyLifecycle.CommandsResolved
-
installersResolved
protected void installersResolved(InstallersResolvedEvent event)
Description copied from class:GuiceyLifecycleAdapter
Called after all installers resolved (including installers found with classpath scan) and prepared for processing extensions.- Overrides:
installersResolved
in classGuiceyLifecycleAdapter
- Parameters:
event
- event object- See Also:
GuiceyLifecycle.InstallersResolved
-
manualExtensionsValidated
protected void manualExtensionsValidated(ManualExtensionsValidatedEvent event)
Description copied from class:GuiceyLifecycleAdapter
Called when all manually registered extension classes are recognized by installers (validated). But only extensions, known to be enabled at that time are actually validated (this way it is possible to exclude extensions for non existing installers). Called only if at least one manual extension registered.- Overrides:
manualExtensionsValidated
in classGuiceyLifecycleAdapter
- Parameters:
event
- event object- See Also:
GuiceyLifecycle.ManualExtensionsValidated
-
classpathExtensionsResolved
protected void classpathExtensionsResolved(ClasspathExtensionsResolvedEvent event)
Description copied from class:GuiceyLifecycleAdapter
Called when classes from classpath scan analyzed and all extensions detected. Called only if classpath scan is enabled and at least one extension detected.- Overrides:
classpathExtensionsResolved
in classGuiceyLifecycleAdapter
- Parameters:
event
- event object- See Also:
GuiceyLifecycle.ClasspathExtensionsResolved
-
bundlesStarted
protected void bundlesStarted(BundlesStartedEvent event)
Description copied from class:GuiceyLifecycleAdapter
Called after bundles start (run method call). Not called if no bundles were used at all.- Overrides:
bundlesStarted
in classGuiceyLifecycleAdapter
- Parameters:
event
- event object- See Also:
GuiceyLifecycle.BundlesStarted
-
modulesAnalyzed
protected void modulesAnalyzed(ModulesAnalyzedEvent event)
Description copied from class:GuiceyLifecycleAdapter
Called when guice bindings analyzed and all extensions detected. Called only if bindings analysis is enabled.- Overrides:
modulesAnalyzed
in classGuiceyLifecycleAdapter
- Parameters:
event
- event object- See Also:
GuiceyLifecycle.ModulesAnalyzed
-
extensionsResolved
protected void extensionsResolved(ExtensionsResolvedEvent event)
Description copied from class:GuiceyLifecycleAdapter
Called when all extensions detected (from classpath scan and guice modules). Called even if no extensions configured to indicate configuration state.- Overrides:
extensionsResolved
in classGuiceyLifecycleAdapter
- Parameters:
event
- event object- See Also:
GuiceyLifecycle.ExtensionsResolved
-
injectorCreation
protected void injectorCreation(InjectorCreationEvent event)
Description copied from class:GuiceyLifecycleAdapter
Called just before guice injector creation. Called even if no modules were used at all (to indicate major lifecycle point).- Overrides:
injectorCreation
in classGuiceyLifecycleAdapter
- Parameters:
event
- event object- See Also:
GuiceyLifecycle.InjectorCreation
-
extensionsInstalled
protected void extensionsInstalled(ExtensionsInstalledEvent event)
Description copied from class:GuiceyLifecycleAdapter
Called after all installers install related extensions. Not called when no extensions installed.- Overrides:
extensionsInstalled
in classGuiceyLifecycleAdapter
- Parameters:
event
- event object- See Also:
GuiceyLifecycle.ExtensionsInstalled
-
applicationRun
protected void applicationRun(ApplicationRunEvent event)
Description copied from class:GuiceyLifecycleAdapter
Called afterGuiceBundle.run(io.dropwizard.Configuration, io.dropwizard.setup.Environment)
when guicey context is started, extensions installed (but not hk extensions, because neither jersey nor jetty isn't start yet).- Overrides:
applicationRun
in classGuiceyLifecycleAdapter
- Parameters:
event
- event object- See Also:
GuiceyLifecycle.ApplicationRun
-
jerseyConfiguration
protected void jerseyConfiguration(JerseyConfigurationEvent event)
Description copied from class:GuiceyLifecycleAdapter
Jersey context starting. At this point jersey and jetty is only initializing. Guicey jersey configuration is not yer performed. Since that point jerseyInjectionManager
is accessible.- Overrides:
jerseyConfiguration
in classGuiceyLifecycleAdapter
- Parameters:
event
- event object- See Also:
GuiceyLifecycle.JerseyConfiguration
-
jerseyExtensionsInstalled
protected void jerseyExtensionsInstalled(JerseyExtensionsInstalledEvent event)
Description copied from class:GuiceyLifecycleAdapter
Called after allJerseyInstaller
installers install related extensions and only when at least one extension was installed.- Overrides:
jerseyExtensionsInstalled
in classGuiceyLifecycleAdapter
- Parameters:
event
- event object- See Also:
GuiceyLifecycle.JerseyExtensionsInstalled
-
-