Search in sources :

Example 1 with Deactivate

use of org.osgi.service.component.annotations.Deactivate in project sling by apache.

the class PostOperationProxyProvider method deactivate.

/**
     * Deactivates the proxy provide component:
     * <ol>
     * <li>Unregister as a service listener</li>
     * <li>Unregister all proxies</li>
     * <li>Drop BundleContext reference</li>
     * </ol>
     */
@SuppressWarnings("unused")
@Deactivate
private void deactivate() {
    this.bundleContext.removeServiceListener(this);
    final ServiceReference[] serviceReferences;
    synchronized (this.proxies) {
        serviceReferences = this.proxies.keySet().toArray(new ServiceReference[this.proxies.size()]);
    }
    for (ServiceReference serviceReference : serviceReferences) {
        unregister(serviceReference);
    }
    this.bundleContext = null;
}
Also used : ServiceReference(org.osgi.framework.ServiceReference) Deactivate(org.osgi.service.component.annotations.Deactivate)

Example 2 with Deactivate

use of org.osgi.service.component.annotations.Deactivate in project sling by apache.

the class QueueManager method deactivate.

/**
     * Deactivate this component.
     */
@Deactivate
protected void deactivate() {
    logger.debug("Apache Sling Queue Manager stopping on instance {}", Environment.APPLICATION_ID);
    this.configuration.removeListener(this);
    final Iterator<JobQueueImpl> i = this.queues.values().iterator();
    while (i.hasNext()) {
        final JobQueueImpl jbq = i.next();
        jbq.close();
        // update mbeans
        ((QueuesMBeanImpl) queuesMBean).sendEvent(new QueueStatusEvent(null, jbq));
    }
    this.queues.clear();
    this.queueServices = null;
    logger.info("Apache Sling Queue Manager stopped on instance {}", Environment.APPLICATION_ID);
}
Also used : QueueStatusEvent(org.apache.sling.event.impl.jobs.jmx.QueueStatusEvent) QueuesMBeanImpl(org.apache.sling.event.impl.jobs.jmx.QueuesMBeanImpl) Deactivate(org.osgi.service.component.annotations.Deactivate)

Example 3 with Deactivate

use of org.osgi.service.component.annotations.Deactivate in project sling by apache.

the class MetricsServiceImpl method deactivate.

@Deactivate
private void deactivate() throws IOException {
    for (ServiceRegistration reg : regs) {
        reg.unregister();
    }
    regs.clear();
    gaugeManager.close();
    metrics.clear();
    if (reporter != null) {
        reporter.close();
    }
}
Also used : ServiceRegistration(org.osgi.framework.ServiceRegistration) Deactivate(org.osgi.service.component.annotations.Deactivate)

Aggregations

Deactivate (org.osgi.service.component.annotations.Deactivate)3 QueueStatusEvent (org.apache.sling.event.impl.jobs.jmx.QueueStatusEvent)1 QueuesMBeanImpl (org.apache.sling.event.impl.jobs.jmx.QueuesMBeanImpl)1 ServiceReference (org.osgi.framework.ServiceReference)1 ServiceRegistration (org.osgi.framework.ServiceRegistration)1