Class ServiceUtils
- java.lang.Object
-
- org.apache.felix.http.base.internal.util.ServiceUtils
-
public abstract class ServiceUtils extends Object
Utility methods to get/unget services, ignoring exceptions that might occur on bundle stop/update
-
-
Constructor Summary
Constructors Constructor Description ServiceUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> T
safeGetService(org.osgi.framework.BundleContext ctx, org.osgi.framework.ServiceReference<T> ref)
Get the servicestatic <T> T
safeGetServiceObjects(org.osgi.framework.BundleContext ctx, org.osgi.framework.ServiceReference<T> ref)
Get the service usingServiceObjects
static <T> void
safeUngetService(org.osgi.framework.BundleContext ctx, org.osgi.framework.ServiceReference<T> ref)
Unget the servicestatic <T> void
safeUngetServiceObjects(org.osgi.framework.BundleContext ctx, org.osgi.framework.ServiceReference<T> ref, T service)
Unget the service usingServiceObjects
-
-
-
Method Detail
-
safeGetService
public static <T> T safeGetService(org.osgi.framework.BundleContext ctx, org.osgi.framework.ServiceReference<T> ref)
Get the service- Returns:
- The service or
null
-
safeUngetService
public static <T> void safeUngetService(org.osgi.framework.BundleContext ctx, org.osgi.framework.ServiceReference<T> ref)
Unget the service
-
safeGetServiceObjects
public static <T> T safeGetServiceObjects(org.osgi.framework.BundleContext ctx, org.osgi.framework.ServiceReference<T> ref)
Get the service usingServiceObjects
- Returns:
- The service or
null
-
safeUngetServiceObjects
public static <T> void safeUngetServiceObjects(org.osgi.framework.BundleContext ctx, org.osgi.framework.ServiceReference<T> ref, T service)
Unget the service usingServiceObjects
-
-