public final class WaitingServiceTracker<T> extends Object implements AutoCloseable
Modifier and Type | Field and Description |
---|---|
static long |
FIVE_MINUTES |
Modifier and Type | Method and Description |
---|---|
void |
close() |
static <T> WaitingServiceTracker<T> |
create(Class<T> serviceInterface,
org.osgi.framework.BundleContext context)
Creates an instance.
|
static <T> WaitingServiceTracker<T> |
create(Class<T> serviceInterface,
org.osgi.framework.BundleContext context,
String filter)
Creates an instance.
|
T |
waitForService(long timeoutInMillis)
Waits for an OSGi services.
|
public T waitForService(long timeoutInMillis) throws ServiceNotFoundException
timeoutInMillis
- the timeout in millisServiceNotFoundException
- if it times out or is interruptedpublic static <T> WaitingServiceTracker<T> create(@Nonnull Class<T> serviceInterface, @Nonnull org.osgi.framework.BundleContext context)
serviceInterface
- the service interfacecontext
- the BundleContextpublic static <T> WaitingServiceTracker<T> create(@Nonnull Class<T> serviceInterface, @Nonnull org.osgi.framework.BundleContext context, @Nonnull String filter)
serviceInterface
- the service interfacecontext
- the BundleContextfilter
- the OSGi service filterpublic void close()
close
in interface AutoCloseable
Copyright © 2019 OpenDaylight. All rights reserved.