use of org.jvnet.hk2.external.runtime.ServiceLocatorRuntimeBean in project jersey by jersey.
the class HK2InjectionManager method initialize.
@Override
public void initialize(String name, Object parent, Binder... binders) {
ServiceLocator parentLocator = resolveServiceLocatorParent(parent);
this.locator = createLocator(name, parentLocator);
// Register all components needed for proper HK2 locator bootstrap
Hk2Helper.bind(locator, new Hk2BootstrapBinder(this, CompositeBinder.wrap(binders)));
this.locator.setDefaultClassAnalyzerName(JerseyClassAnalyzer.NAME);
// clear HK2 caches
ServiceLocatorRuntimeBean serviceLocatorRuntimeBean = locator.getService(ServiceLocatorRuntimeBean.class);
if (serviceLocatorRuntimeBean != null) {
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine(LocalizationMessages.HK_2_CLEARING_CACHE(serviceLocatorRuntimeBean.getServiceCacheSize(), serviceLocatorRuntimeBean.getReflectionCacheSize()));
}
serviceLocatorRuntimeBean.clearReflectionCache();
serviceLocatorRuntimeBean.clearServiceCache();
}
}
Aggregations