@Override public void stop(BundleContext context) throws Exception { registrationS.unregister(); registrationP.unregister(); } }
ServiceReference sref = registration.getReference(); String parserFactoryClassName = (String) sref.getProperty(FACTORYNAMEKEY); ((SAXParserFactory) factory).setValidating(((Boolean) sref.getProperty(PARSER_VALIDATING)).booleanValue()); ((SAXParserFactory) factory).setNamespaceAware(((Boolean) sref.getProperty(PARSER_NAMESPACEAWARE)).booleanValue()); } else { if (factory instanceof DocumentBuilderFactory) {
/** {@inheritDoc} */ public void stop(BundleContext pBundleContext) { assert pBundleContext.equals(bundleContext); if (httpServiceTracker != null) { // Closing the tracker will also call {@link HttpServiceCustomizer#removedService()} // for every active service which in turn unregisters the servlet httpServiceTracker.close(); httpServiceTracker = null; } if (jolokiaServiceRegistration != null) { jolokiaServiceRegistration.unregister(); jolokiaServiceRegistration = null; } //Shut this down last to make sure nobody calls for a property after this is shutdown if (configAdminTracker != null) { configAdminTracker.close(); configAdminTracker = null; } if (jolokiaHttpContext instanceof ServiceAuthenticationHttpContext) { final ServiceAuthenticationHttpContext context = (ServiceAuthenticationHttpContext) jolokiaHttpContext; context.close(); } restrictor = null; bundleContext = null; }
@Deactivate protected void deactivate() { if (reg != null) { reg.unregister(); } }
= bundleContext.getService(serviceRegistration.getReference()); serviceRegistration.unregister(); if (videobridge != null) videobridge.stop(bundleContext);
private void resolveAll() { ServiceRegistration<ResolverHookFactory> registration = context .registerService(ResolverHookFactory.class, (triggers) -> resolver, null); try { context.getBundle().adapt(FrameworkWiring.class) .resolveBundles(Arrays.asList(context.getBundles())); } finally { registration.unregister(); } } }
private void registerOrUpdate(Dictionary<?, ?> properties) { if (properties == null) { if (scriptChangeListenerRegistration != null) { scriptChangeListenerRegistration.unregister(); scriptChangeListenerRegistration = null; } } else if (scriptChangeListenerRegistration != null) { scriptChangeListenerRegistration.setProperties(properties); } else { scriptChangeListenerRegistration = bundleContext.registerService(EventHandler.class.getName(), this, properties); } }
/** {@inheritDoc}*/ public void stop(BundleContext context) throws Exception { context.removeBundleListener(cxfBundleListener); cxfBundleListener.shutdown(); workQueues.shutDown(); workQueueServiceRegistration.unregister(); wqSingleConfigRegistratin.unregister(); configAdminTracker.close(); ExtensionRegistry.removeExtensions(extensions); }
@Override public void removedService(ServiceReference reference, Object service) { ApplicationFactory factory = (ApplicationFactory) context.getService(reference); final ServiceRegistration servletRegistration = m_serviceRegistration.remove(factory); if (servletRegistration != null) { servletRegistration.unregister(); } super.removedService(reference, service); }
public void removedService( final ServiceReference<ServiceComponentRuntime> reference, final ServiceComponentRuntime service) { final ServiceRegistration<ScrService> reg = scrServiceRegMap.remove(reference.getProperty(Constants.SERVICE_ID)); if ( reg != null ) { reg.unregister(); } context.ungetService(reference); } });
@Deactivate protected void deactivate(ComponentContext context) { this.yardTracker.close(); this.yardTracker = null; this.cc = null; this.yard = null; this.cache = null; if(this.cacheRegistration != null){ cacheRegistration.unregister(); cacheRegistration = null; } }
@Override public void run(final ProxyManager pm) throws Exception { String[] objectClassProperty = (String[]) originalRef.getProperty(Constants.OBJECTCLASS); ServiceFactory<Object> sf = new ProxyServiceFactory(pm, originalRef); registrationHolder.registration = originalRef.getBundle().getBundleContext().registerService( objectClassProperty, sf, proxyPropertiesRoles()); Dictionary<String, Object> actualProxyProps = copyProperties(registrationHolder.registration.getReference()); LOG.debug("Created proxy of service {} under {} with properties {}", orgServiceID, actualProxyProps.get(Constants.OBJECTCLASS), actualProxyProps); }
private void deregisterInstance(HazelcastOSGiInstance hazelcastOSGiInstance) { instanceMap.remove(hazelcastOSGiInstance.getName()); ServiceRegistration serviceRegistration = instanceServiceRegistrationMap.remove(hazelcastOSGiInstance); if (serviceRegistration != null) { ownerBundleContext.ungetService(serviceRegistration.getReference()); serviceRegistration.unregister(); } }
long registerService() { final Bundle bundle = this.cache.getBundle(); final Dictionary<String, Object> props = new Hashtable<>(); props.put(Constants.SERVICE_DESCRIPTION, "Provider of bundle based resources from bundle " + String.valueOf(bundle.getBundleId())); props.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation"); props.put(ResourceProvider.PROPERTY_ROOT, this.root.getResourceRoot()); props.put(PROP_BUNDLE,bundle.getBundleId()); serviceRegistration = bundle.getBundleContext().registerService(ResourceProvider.class, this, props); return (Long) serviceRegistration.getReference().getProperty(Constants.SERVICE_ID); }
private void change(final Dictionary filter) { if(null == m_reg) { m_reg = m_context.registerService( UPnPEventListener.class.getName(), this, filter); } else { m_reg.setProperties(filter); } }
/** * Stops this {@code Activator}. * * @param bundleContext the {@code BundleContext} in which this * {@code Activator} is stopping * @throws Exception error stopping and removing dependent services. */ @Override public void stop(BundleContext bundleContext) throws Exception { bundleContext.removeServiceListener(this); if (serviceRegistration != null) { serviceRegistration.unregister(); serviceRegistration = null; } if (conferenceStatsHandler != null) { conferenceStatsHandler.stop(); conferenceStatsHandler = null; } }
private void unregister(ServiceReference reference, ConcurrentMap<Long, ServiceRegistration> mbeans) { Long id = (Long) reference.getProperty(Constants.SERVICE_ID); ServiceRegistration reg = mbeans.remove(id); if (reg != null) reg.unregister(); }
public void stop(BundleContext context) { eventAdminAdapter.stop(); eventAdminAdapter = null; logServiceRegistration.unregister(); logServiceRegistration = null; logReaderServiceRegistration.unregister(); logReaderServiceRegistration = null; logServiceFactory.shutdown(); context.removeFrameworkListener(this); context.removeServiceListener(this); context.removeBundleListener(this); }
@Override public void execute(String id) { AutomaticPackageReplicatorJob job = (AutomaticPackageReplicatorJob) getBundleContext() .getService(super.getRegisteredServices().get(id).getReference()); job.run(); }
@Override public void removedService(ServiceReference<DataSourceFactory> reference, ServiceRegistration<DataSourceFactory> reg) { LOG.debug("Unregistering PooledDataSourceFactory"); reg.unregister(); super.removedService(reference, reg); }