use of org.eclipse.osgi.util.NLS in project rt.equinox.framework by eclipse.
the class ServiceFactoryUse method ungetService.
/**
* Unget a service's service object.
*
* <p>
* Decrements the use count if the service was being used.
*
* <p>The following steps are followed to unget the service object:
* <ol>
* <li>If the use count is zero, return.
* <li>The use count is decremented by one.
* <li>If the use count is non zero, return.
* <li>The {@link ServiceFactory#ungetService(Bundle, ServiceRegistration, Object)} method
* is called to release the service object for the context bundle.
* </ol>
* @return true if the service was ungotten; otherwise false.
*/
/* @GuardedBy("this") */
@Override
boolean ungetService() {
assert Thread.holdsLock(this);
if (!inUse()) {
return false;
}
decrementUse();
if (inUse()) {
return true;
}
final S service = cachedService;
cachedService = null;
if (debug.DEBUG_SERVICES) {
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
Debug.println("ungetService[factory=" + registration.getBundle() + "](" + context.getBundleImpl() + "," + registration + ")");
}
factoryUngetService(service);
return true;
}
use of org.eclipse.osgi.util.NLS in project rt.equinox.framework by eclipse.
the class ServiceFactoryUse method release.
/**
* Release all uses of the service and reset the use count to zero.
*
* <ol>
* <li>The bundle's use count for this service is set to zero.
* <li>The {@link ServiceFactory#ungetService(Bundle, ServiceRegistration, Object)} method
* is called to release the service object for the bundle.
* </ol>
*/
/* @GuardedBy("this") */
@Override
void release() {
super.release();
final S service = cachedService;
if (service == null) {
return;
}
cachedService = null;
if (debug.DEBUG_SERVICES) {
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
Debug.println("releaseService[factory=" + registration.getBundle() + "](" + context.getBundleImpl() + "," + registration + ")");
}
factoryUngetService(service);
}
Aggregations