Class ServiceUtils
java.lang.Object
org.apache.felix.http.base.internal.util.ServiceUtils
Utility methods to get/unget services, ignoring exceptions that might occur
on bundle stop/update
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <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
-
Constructor Details
-
ServiceUtils
public ServiceUtils()
-
-
Method Details
-
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
-