org.glassfish.jersey.server.monitoring

## Interface ApplicationInfo

    public interface ApplicationInfo

Monitoring configuration of an application.

Application info instance can be injected, e.g:

       @Path("resource")
       public static class ApplicationInfoTest {
           @Inject
           Provider<ApplicationInfo> applicationInfoProvider;

           @GET
           public String getAppName() throws InterruptedException {
               final ApplicationInfo applicationInfo = appInfoProvider.get();
               final String name = applicationInfo.getResourceConfig().getApplicationName();

               return name;
           }
       }

Note usage of `Provider` to retrieve application info. Info changes over time and this will inject the latest info. In the case of singleton resources usage of `Provider` is the only way how to inject application info that are up to date.

Application info retrieved from Jersey runtime might be mutable and thanks to it might provide inconsistent data as not all attributes are updated in the same time. To retrieve the immutable and consistent data the method `snapshot()` should be used.

Since:
  2.12
Author:
  Miroslav Fuksa, Libor Kramolis
See Also:
  `ApplicationEvent`, `ApplicationEventListener`, `See MonitoringStatistics class for general details about statistics.`

### Method Summary

All Methods Instance Methods Abstract Methods
`Set<Class<?>>` `getProviders()` Get registered providers available in the runtime.
`Set<Class<?>>` `getRegisteredClasses()` Get resource classes registered by the user in the current application.
`Set<Object>` `getRegisteredInstances()` Get resource instances registered by the user in the current application.
`ResourceConfig` `getResourceConfig()` Get the resource config.
`Date` `getStartTime()` Get the start time of the application.
`ApplicationInfo` `snapshot()` Get the immutable consistent snapshot of the application info.

### Method Detail

#### getResourceConfig

    ResourceConfig getResourceConfig()

Get the resource config.

Returns:
  Resource config.

#### getStartTime

    Date getStartTime()

Get the start time of the application.

Returns:
  Time when an application initialization has been finished.

#### getRegisteredClasses

    Set<Class<?>> getRegisteredClasses()

Get resource classes registered by the user in the current application. The set contains only user resource classes and not resource classes added by Jersey or by `ModelProcessor`.

User resources are resources that were explicitly registered by the configuration, discovered by the class path scanning or that constructs explicitly registered `programmatic resource`.

Returns:
  Resource user registered classes.

#### getRegisteredInstances

    Set<Object> getRegisteredInstances()

Get resource instances registered by the user in the current application. The set contains only user resources and not resources added by Jersey or by `ModelProcessor`.

User resources are resources that were explicitly registered by the configuration, discovered by the class path scanning or that constructs explicitly registered `programmatic resource`.

Returns:
  Resource instances registered by user.

#### getProviders

    Set<Class<?>> getProviders()

Get registered providers available in the runtime. The registered providers are providers like `filters`, `reader` and `writer` interceptors which are explicitly registered by configuration, or annotated by `@Provider` or registered in META-INF/services. The set does not include providers that are by default built in Jersey.

Returns:
  Set of provider classes.

#### snapshot

    ApplicationInfo snapshot()

Get the immutable consistent snapshot of the application info. Working with snapshots might have negative performance impact as snapshot must be created but ensures consistency of data over time. However, the usage of snapshot is encouraged to avoid working with inconsistent data. Not all attributes must be updated in the same time on mutable version of info.

Returns:
  Snapshot of application info.