Package org.glassfish.internal.api
Class Globals
- java.lang.Object
-
- org.glassfish.internal.api.Globals
-
@Service(name="globals") @Singleton public class Globals extends Object
Global class for storing the service locator for all hk2 servicesVery sensitive class, anything stored here cannot be garbage collected
- Author:
- Jerome Dochez
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Globals.GlobalsInitializer
The point of this service is to ensure that the Globals service is properly initialized by the RunLevelService at the InitRunLevel.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> T
get(Class<T> type)
Gets the service from the default service locator with the specified typestatic org.glassfish.hk2.api.ServiceLocator
getDefaultBaseServiceLocator()
Gets the default service locatorstatic org.glassfish.hk2.api.ServiceLocator
getDefaultHabitat()
Gets the default service locatorstatic org.glassfish.hk2.api.ServiceLocator
getStaticBaseServiceLocator()
Returns the default service locator.static org.glassfish.hk2.api.ServiceLocator
getStaticHabitat()
Returns the default service locator.static void
setDefaultHabitat(org.glassfish.hk2.api.ServiceLocator habitat)
Sets the default service locator to a different one
-
-
-
Method Detail
-
getDefaultBaseServiceLocator
public static org.glassfish.hk2.api.ServiceLocator getDefaultBaseServiceLocator()
Gets the default service locatorThis method is identical to
getDefaultBaseServiceLocator()
- Returns:
-
getDefaultHabitat
public static org.glassfish.hk2.api.ServiceLocator getDefaultHabitat()
Gets the default service locatorThis method is identical to
getDefaultBaseServiceLocator()
- Returns:
-
get
public static <T> T get(Class<T> type)
Gets the service from the default service locator with the specified typeSee
ServiceLocator.getService(java.lang.Class, java.lang.annotation.Annotation...)
- Type Parameters:
T
-- Parameters:
type
-- Returns:
-
setDefaultHabitat
public static void setDefaultHabitat(org.glassfish.hk2.api.ServiceLocator habitat)
Sets the default service locator to a different one- Parameters:
habitat
-
-
getStaticBaseServiceLocator
public static org.glassfish.hk2.api.ServiceLocator getStaticBaseServiceLocator()
Returns the default service locator. If it does not exist, one will be created.- Returns:
-
getStaticHabitat
public static org.glassfish.hk2.api.ServiceLocator getStaticHabitat()
Returns the default service locator. If it does not exist, one will be created.- Returns:
-
-