當前位置: 首頁>>代碼示例>>Java>>正文


Java BundleContext.ungetService方法代碼示例

本文整理匯總了Java中org.osgi.framework.BundleContext.ungetService方法的典型用法代碼示例。如果您正苦於以下問題:Java BundleContext.ungetService方法的具體用法?Java BundleContext.ungetService怎麽用?Java BundleContext.ungetService使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.osgi.framework.BundleContext的用法示例。


在下文中一共展示了BundleContext.ungetService方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: stop

import org.osgi.framework.BundleContext; //導入方法依賴的package包/類
@Override
public void stop(BundleContext context) throws Exception {
    randomNumberServiceTracker.close();
    if (serviceReference != null) {
        context.ungetService(serviceReference);
        serviceReference = null;
    }
}
 
開發者ID:L7R7,項目名稱:magic-bundle,代碼行數:9,代碼來源:Activator.java

示例2: unsetServiceReference

import org.osgi.framework.BundleContext; //導入方法依賴的package包/類
private void unsetServiceReference(BundleContext context) {
    if (serviceReference != null) {
        if (context != null) {
            context.ungetService(serviceReference);
        }
        serviceReference = null;
    }
}
 
開發者ID:L7R7,項目名稱:magic-bundle,代碼行數:9,代碼來源:Activator.java

示例3: stop

import org.osgi.framework.BundleContext; //導入方法依賴的package包/類
@Override
public void stop(BundleContext context) throws Exception {
    serviceTracker.close();
    if (randomNumberGeneratorServiceReference != null) {
        context.ungetService(randomNumberGeneratorServiceReference);
    }
    if (randomStringGeneratorServiceReference != null) {
        context.ungetService(randomStringGeneratorServiceReference);
    }
}
 
開發者ID:L7R7,項目名稱:magic-bundle,代碼行數:11,代碼來源:Activator.java

示例4: log

import org.osgi.framework.BundleContext; //導入方法依賴的package包/類
protected void log ( final int level, final String message )
{
    final BundleContext context = this.context;
    if ( context == null )
    {
        return;
    }

    final ServiceReference<LogService> ref = context.getServiceReference ( LogService.class );
    if ( ref == null )
    {
        return;
    }

    final LogService service = context.getService ( ref );
    if ( service == null )
    {
        return;
    }

    try
    {
        service.log ( level, message );
    }
    finally
    {
        context.ungetService ( ref );
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:30,代碼來源:Activator.java

示例5: ObjectPoolTracker

import org.osgi.framework.BundleContext; //導入方法依賴的package包/類
public ObjectPoolTracker ( final BundleContext context, final String poolClass ) throws InvalidSyntaxException
{
    final Map<String, String> parameters = new HashMap<String, String> ();
    parameters.put ( ObjectPool.OBJECT_POOL_CLASS, poolClass );
    final Filter filter = FilterUtil.createAndFilter ( ObjectPool.class.getName (), parameters );

    this.poolTracker = new ServiceTracker<ObjectPool<S>, ObjectPool<S>> ( context, filter, new ServiceTrackerCustomizer<ObjectPool<S>, ObjectPool<S>> () {

        @Override
        public void removedService ( final ServiceReference<ObjectPool<S>> reference, final ObjectPool<S> service )
        {
            context.ungetService ( reference );
            ObjectPoolTracker.this.removePool ( service );
        }

        @Override
        public void modifiedService ( final ServiceReference<ObjectPool<S>> reference, final ObjectPool<S> service )
        {
            ObjectPoolTracker.this.modifyPool ( service, reference );
        }

        @Override
        public ObjectPool<S> addingService ( final ServiceReference<ObjectPool<S>> reference )
        {
            final ObjectPool<S> o = context.getService ( reference );
            ObjectPoolTracker.this.addPool ( o, reference );
            return o;
        }
    } );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:31,代碼來源:ObjectPoolTracker.java

示例6: ConnectionAnalyzerFactory

import org.osgi.framework.BundleContext; //導入方法依賴的package包/類
public ConnectionAnalyzerFactory ( final ScheduledExecutorService executor, final BundleContext context )
{
    this.executor = executor;
    this.context = context;
    this.connectionTracker = new ServiceTracker<ConnectionService, ConnectionService> ( context, ConnectionService.class, new ServiceTrackerCustomizer<ConnectionService, ConnectionService> () {

        @Override
        public void removedService ( final ServiceReference<ConnectionService> reference, final ConnectionService service )
        {
            ConnectionAnalyzerFactory.this.removeService ( service );
        }

        @Override
        public void modifiedService ( final ServiceReference<ConnectionService> reference, final ConnectionService service )
        {

        }

        @Override
        public ConnectionService addingService ( final ServiceReference<ConnectionService> reference )
        {
            try
            {
                logger.debug ( "Found new service: {}", reference );
                final ConnectionService service = context.getService ( reference );
                ConnectionAnalyzerFactory.this.addService ( reference, service );
                return service;
            }
            catch ( final Throwable e )
            {
                logger.warn ( "Failed to add service", e );
            }
            context.ungetService ( reference );
            return null;
        }
    } );
    this.connectionTracker.open ();
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:39,代碼來源:ConnectionAnalyzerFactory.java

示例7: removedService

import org.osgi.framework.BundleContext; //導入方法依賴的package包/類
@Override
public default void removedService(
	ServiceReference<T> serviceReference,
	ServiceRegistration<?> serviceRegistration) {

	Bundle bundle = FrameworkUtil.getBundle(
		ServiceRegistrationServiceTrackerCustomizer.class);

	BundleContext bundleContext = bundle.getBundleContext();

	bundleContext.ungetService(serviceReference);

	serviceRegistration.unregister();
}
 
開發者ID:liferay,項目名稱:com-liferay-apio-architect,代碼行數:15,代碼來源:ServiceRegistrationServiceTrackerCustomizer.java

示例8: removedService

import org.osgi.framework.BundleContext; //導入方法依賴的package包/類
@Override
public void removedService(ServiceReference<T> serviceReference, U u) {
	Bundle bundle = FrameworkUtil.getBundle(
		TransformServiceTrackerCustomizer.class);

	BundleContext bundleContext = bundle.getBundleContext();

	bundleContext.ungetService(serviceReference);

	onRemovedService(serviceReference, u);
}
 
開發者ID:liferay,項目名稱:com-liferay-apio-architect,代碼行數:12,代碼來源:TransformServiceTrackerCustomizer.java

示例9: restartConfigModules

import org.osgi.framework.BundleContext; //導入方法依賴的package包/類
private void restartConfigModules(final BundleContext bundleContext, final List<Entry<String,
        ModuleIdentifier>> configModules) {
    if (configModules.isEmpty()) {
        return;
    }

    ServiceReference<ConfigSubsystemFacadeFactory> configFacadeFactoryRef = bundleContext
            .getServiceReference(ConfigSubsystemFacadeFactory.class);
    if (configFacadeFactoryRef == null) {
        LOG.debug("ConfigSubsystemFacadeFactory service reference not found");
        return;
    }

    ConfigSubsystemFacadeFactory configFacadeFactory = bundleContext.getService(configFacadeFactoryRef);
    if (configFacadeFactory == null) {
        LOG.debug("ConfigSubsystemFacadeFactory service not found");
        return;
    }

    try (ConfigSubsystemFacade configFacade = configFacadeFactory.createFacade(
            "BlueprintContainerRestartService")) {
        restartConfigModules(configModules, configFacade);
    } catch (ParserConfigurationException | DocumentedException | ValidationException
            | ConflictingVersionException e) {
        LOG.error("Error restarting config modules", e);
    } finally {
        bundleContext.ungetService(configFacadeFactoryRef);
    }

}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:31,代碼來源:BlueprintContainerRestartServiceImpl.java

示例10: DaveBlockConfigurator

import org.osgi.framework.BundleContext; //導入方法依賴的package包/類
public DaveBlockConfigurator ( final DaveDevice device, final BundleContext context )
{
    this.device = device;
    this.context = context;

    final Map<String, String> parameters = new HashMap<String, String> ();
    parameters.put ( "daveDevice", device.getId () );
    try
    {
        final Filter filter = FilterUtil.createAndFilter ( BlockConfiguration.class.getName (), parameters );
        this.tracker = new ServiceTracker<Object, Object> ( context, filter, new ServiceTrackerCustomizer<Object, Object> () {

            @Override
            public void removedService ( final ServiceReference<Object> reference, final Object service )
            {
                if ( service instanceof BlockConfiguration )
                {
                    if ( DaveBlockConfigurator.this.removeBlock ( reference, (BlockConfiguration)service ) )
                    {
                        context.ungetService ( reference );
                    }
                }
            }

            @Override
            public void modifiedService ( final ServiceReference<Object> reference, final Object service )
            {
                DaveBlockConfigurator.this.modifyBlock ( reference, (BlockConfiguration)service );
            }

            @Override
            public Object addingService ( final ServiceReference<Object> reference )
            {
                final Object o = DaveBlockConfigurator.this.context.getService ( reference );
                try
                {
                    DaveBlockConfigurator.this.addOrReplaceBlock ( reference, (BlockConfiguration)o );
                    return o;
                }
                catch ( final Throwable e )
                {
                    logger.warn ( "Failed to add block", e );
                    return o;
                }
            }
        } );
    }
    catch ( final Exception e )
    {
        logger.warn ( "Failed to configure", e );
    }
    if ( this.tracker != null )
    {
        this.tracker.open ();
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:57,代碼來源:DaveBlockConfigurator.java

示例11: deactivate

import org.osgi.framework.BundleContext; //導入方法依賴的package包/類
@Deactivate
private void deactivate(BundleContext context) {
    if (this.initDone.get()) {
        context.ungetService(this.dsConformanceCheckMetaTaskSR);
    }
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:7,代碼來源:DeploymentSpecConformJobFactory.java

示例12: deactivate

import org.osgi.framework.BundleContext; //導入方法依賴的package包/類
@Deactivate
public void deactivate(BundleContext bundleContext) {
	bundleContext.ungetService(_serviceReference);

	_serviceRegistration.unregister();
}
 
開發者ID:liferay,項目名稱:com-liferay-apio-architect,代碼行數:7,代碼來源:ApioApplicationRegistrar.java


注:本文中的org.osgi.framework.BundleContext.ungetService方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。