Package org.osgi.framework

Examples of org.osgi.framework.BundleContext.ungetService()


           
            @Override
            public Object addingService(ServiceReference reference) {
                Object service = bc.getService(reference);
                if(StanbolNamespacePrefixService.this.equals(service)){//we need not to track this instance
                    bc.ungetService(reference);
                    return null;
                }
                __sortedProviderRef = null;
                return service;
            }
View Full Code Here


        context.addServiceListener(new ServiceListener() {
            public void serviceChanged(final ServiceEvent event) {
                final ServiceReference sr = event.getServiceReference();
                final String className = getClassName(sr, myContext);
                if (sr != null) {
                    myContext.ungetService(sr);
                }
                if (className == null) {
                    // Something went wrong
                    return;
                }
View Full Code Here

        } catch (InvalidSyntaxException e) {
            LOGGER.error("Syntax error looking up service {} using filter {}", EventHandler.class.getName(), EventHandler.MANAGED_FILTER);
        } finally {
            if (references != null) {
                for (ServiceReference ref : references) {
                    bundleContext.ungetService(ref);
                }
            }
        }
        return result;
    }
View Full Code Here

                LogUtil.debug(PluginManager.class.getName(), " plugin classloader: " + obj.getClass().getClassLoader());
                LogUtil.debug(PluginManager.class.getName(), " current classloader: " + Plugin.class.getClassLoader());
                if (isPlugin) {
                    plugin = (Plugin) obj;
                }
                context.ungetService(sr);
            }
        } catch (Exception ex) {
            LogUtil.error(PluginManager.class.getName(), ex, "");
            throw new PluginException("Plugin " + name + " could not be retrieved", ex);
        }
View Full Code Here

                    LogUtil.debug(PluginManager.class.getName(), " bundle service: " + sr);
                    Object obj = context.getService(sr);
                    if (obj instanceof Plugin) {
                        list.add((Plugin) obj);
                    }
                    context.ungetService(sr);
                }
            }
        }
        return list;
    }
View Full Code Here

        BundleContext context = felix.getBundleContext();
        ServiceReference sr = context.getServiceReference(name);
        if (sr != null) {
            try {
                sr.getBundle().stop();
                context.ungetService(sr);
                result = true;
            } catch (Exception ex) {
                LogUtil.error(PluginManager.class.getName(), ex, "");
            }
        }
View Full Code Here

            try {
                Bundle bundle = sr.getBundle();
                bundle.stop();
                bundle.uninstall();
                String location = bundle.getLocation();
                context.ungetService(sr);

                // delete location
                if (deleteFile) {
                    File file = new File(new URI(location));
                    boolean deleted = file.delete();
View Full Code Here

                try {
                    if (target instanceof Function) {
                        function = (Function) target;
                    }
                } finally {
                    context.ungetService(reference);
                }
            }
        } catch (Throwable t) {
        }
        return function;
View Full Code Here

        if(bc != null){
            trackedServiceCount--;
            if(trackedServiceCount == 0 && engineRegistration != null){
               engineRegistration.unregister();
            }
            bc.ungetService(reference);
        }
    }
}
View Full Code Here

        BundleContext context = PortfolioPlugin.getDefault().getBundle().getBundleContext();
        ServiceReference<?> reference = context.getServiceReference(name);
        if (reference == null)
            return null;
        Object result = context.getService(reference);
        context.ungetService(reference);
        return type.cast(result);
    }

    private void loadRepository(IProvisioningAgent agent) throws CoreException
    {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.