T - public class ServiceChecker<T>
extends java.lang.Object
CountDownLatch. Internally it uses the service tracker to
Track services| Constructor and Description |
|---|
ServiceChecker(java.lang.Class<T> serviceClass,
BundleContext context)
Creates a new instance.
|
ServiceChecker(Filter filter,
BundleContext context)
Creates a new instance.
|
ServiceChecker(java.lang.String filter,
BundleContext context)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitCreation()
Awaits the service creation to the given timeout
|
boolean |
awaitModification()
Awaits the service modification to the given timeout
|
boolean |
awaitRemoval()
Awaits the service removal to the given timeout
|
int |
getCreateExpectationCount()
Returns the expectation count for create
|
int |
getCreateTimeout()
Returns the value for the timeout of a service creation
|
int |
getCurrentCreateCount(boolean wait)
Returns the current count, how many times the create of a service was triggered
|
int |
getCurrentModifyCount(boolean wait)
Returns the current count, how many times the modification of a service was triggered
|
int |
getCurrentRemoveCount(boolean wait)
Returns the current count, how many times the removal of a service was triggered
|
int |
getModifyExpectationCount()
Returns the expectation count for service modification
|
int |
getModifyTimeout()
Returns the value for the timeout of a service modification
|
int |
getRemovalExpectationCount()
Returns the expectation count for service removal
|
int |
getRemoveTimeout()
Returns the value for the timeout of a service removal
|
T |
getTrackedService()
Returns the tracked service, that maybe
null. |
<any> |
getTrackedServiceReference()
Returns the tracked service reference, that maybe
null |
void |
setCreateExpectationCount(int createExpected)
Sets the expectation count for service creations.
|
void |
setCreateTimeout(int createTimeout)
Sets the timeout in seconds for a service creation
|
void |
setModifyExpectationCount(int modifyExpected)
Sets the expectation count for service modification.
|
void |
setModifyTimeout(int modifyTimeout)
Sets the timeout in seconds for a service modification
|
void |
setRemovalExpectationCount(int removeExpected)
Sets the expectation count for service removals.
|
void |
setRemovalTimeout(int removalTimeout)
Sets the timeout in seconds for a service removal
|
void |
start()
Starts the checker
|
void |
stop()
Stops the service checker
|
public ServiceChecker(java.lang.Class<T> serviceClass, BundleContext context)
serviceClass - the class to be trackedcontext - the bundle contextpublic ServiceChecker(java.lang.String filter,
BundleContext context)
throws InvalidSyntaxException
filter - the filter as stringcontext - the bundle contextInvalidSyntaxExceptionpublic ServiceChecker(Filter filter,
BundleContext context)
filter - the filtercontext - the bundle contextpublic int getCreateExpectationCount()
public void setCreateExpectationCount(int createExpected)
createExpected - the value that will be expectedpublic int getModifyExpectationCount()
public void setModifyExpectationCount(int modifyExpected)
createExpected - the value that will be expectedpublic int getRemovalExpectationCount()
public void setRemovalExpectationCount(int removeExpected)
removeExpected - the value that will be expectedpublic int getCreateTimeout()
public void setCreateTimeout(int createTimeout)
createTimeout - the value to be setpublic int getModifyTimeout()
public void setModifyTimeout(int modifyTimeout)
modifyTimeout - the value to be setpublic int getRemoveTimeout()
public void setRemovalTimeout(int removalTimeout)
removalTimeout - the value to be setpublic void start()
public void stop()
public T getTrackedService()
null. It waits max 1s for the service to comenullpublic <any> getTrackedServiceReference()
nullnullpublic boolean awaitCreation()
throws java.lang.InterruptedException
true, if finishedjava.lang.InterruptedExceptionpublic boolean awaitModification()
throws java.lang.InterruptedException
true, if finishedjava.lang.InterruptedExceptionpublic boolean awaitRemoval()
throws java.lang.InterruptedException
true, if finishedjava.lang.InterruptedExceptionpublic int getCurrentCreateCount(boolean wait)
wait - true, if wait till the given create timeout, default is 5 secondspublic int getCurrentModifyCount(boolean wait)
wait - true, if wait till the given create timeout, default is 5 secondspublic int getCurrentRemoveCount(boolean wait)
wait - true, if wait till the given create timeout, default is 5 secondsData In Motion Consulting GmbH