Package ru.vyarus.dropwizard.guice.debug
Class StartupTimeDiagnostic
- java.lang.Object
-
- ru.vyarus.dropwizard.guice.module.lifecycle.GuiceyLifecycleAdapter
-
- ru.vyarus.dropwizard.guice.module.lifecycle.UniqueGuiceyLifecycleListener
-
- ru.vyarus.dropwizard.guice.debug.StartupTimeDiagnostic
-
- All Implemented Interfaces:
GuiceyLifecycleListener
public class StartupTimeDiagnostic extends UniqueGuiceyLifecycleListener
Startup time report. Timers could count only time AFTER guice bundle creation (with guice bundle itself).Report hacks dropwizard bundles and managed objects to track all bundles time. Note that it is impossible to track init time of bundles registered before guice bundle.
Entire application startup time (measured since guice bundle creation) is split into 3 chunks:
- init phase - all dropwizard bundle init methods called
- run phase - all dropwizard bundles run methods called (+ time of Configuration and Environment creation); also includes application init method
- web phase - everything after last dropwizard bundle run (including application run method)
To avoid confusion with server startup time - jvm start time is also shown (time from jvm start and before guice bundle creation).
- Since:
- 07.03.2025
-
-
Constructor Summary
Constructors Constructor Description StartupTimeDiagnostic()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidapplicationRun(ApplicationRunEvent event)Called afterGuiceBundle.run(io.dropwizard.core.Configuration, io.dropwizard.core.setup.Environment)when guicey context is started, extensions installed (but not hk extensions, because neither jersey nor jetty isn't start yet).protected voidbeforeInit(BeforeInitEvent event)Special meta event, called before allGuiceBundleconfiguration phase logic.protected voidbeforeRun(BeforeRunEvent event)Meta event.protected voidbundlesInitialized(BundlesInitializedEvent event)Called after bundles initialization.-
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, bundlesResolved, bundlesStarted, classpathExtensionsResolved, commandsResolved, configurationHooksProcessed, dropwizardBundlesInitialized, extensionsInstalled, extensionsInstalledBy, extensionsResolved, initialized, injectorCreation, installersResolved, jerseyConfiguration, jerseyExtensionsInstalled, jerseyExtensionsInstalledBy, lookupBundlesResolved, manualExtensionsValidated, modulesAnalyzed, onEvent
-
-
-
-
Method Detail
-
beforeInit
protected void beforeInit(BeforeInitEvent event)
Description copied from class:GuiceyLifecycleAdapterSpecial meta event, called before allGuiceBundleconfiguration phase logic.Bootstrapobject is available, but dropwizard bundles (registered through guicey) are not yet registered (note thatGuiceBundleis not yet added to bootstrap also because dropwizard calls bundle initialization before registering bundle (and so all dropwizard bundles, registered by guicey, will run beforeGuiceBundlerun).- Overrides:
beforeInitin classGuiceyLifecycleAdapter- Parameters:
event- event object- See Also:
GuiceyLifecycle.BeforeInit
-
bundlesInitialized
protected void bundlesInitialized(BundlesInitializedEvent event)
Description copied from class:GuiceyLifecycleAdapterCalled 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:
bundlesInitializedin classGuiceyLifecycleAdapter- Parameters:
event- event object- See Also:
GuiceyLifecycle.BundlesInitialized
-
beforeRun
protected void beforeRun(BeforeRunEvent event)
Description copied from class:GuiceyLifecycleAdapterMeta event. Called just before guice bundle processing in run phase.- Overrides:
beforeRunin classGuiceyLifecycleAdapter- Parameters:
event- event object- See Also:
GuiceyLifecycle.BeforeRun
-
applicationRun
protected void applicationRun(ApplicationRunEvent event)
Description copied from class:GuiceyLifecycleAdapterCalled afterGuiceBundle.run(io.dropwizard.core.Configuration, io.dropwizard.core.setup.Environment)when guicey context is started, extensions installed (but not hk extensions, because neither jersey nor jetty isn't start yet).- Overrides:
applicationRunin classGuiceyLifecycleAdapter- Parameters:
event- event object- See Also:
GuiceyLifecycle.ApplicationRun
-
-