public abstract class AbstractServiceWithBackgroundCheck
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected org.apache.sling.discovery.commons.providers.spi.base.AbstractServiceWithBackgroundCheck.BackgroundCheckRunnable |
backgroundCheckRunnable |
protected org.slf4j.Logger |
logger |
protected java.lang.String |
slingId |
Constructor and Description |
---|
AbstractServiceWithBackgroundCheck() |
Modifier and Type | Method and Description |
---|---|
protected void |
cancelPreviousBackgroundCheck()
Cancel the currently ongoing background check if
there is any ongoing.
|
protected void |
startBackgroundCheck(java.lang.String threadName,
org.apache.sling.discovery.commons.providers.spi.base.AbstractServiceWithBackgroundCheck.BackgroundCheck check,
java.lang.Runnable callback,
long timeoutMillis,
long waitMillis)
Start a new BackgroundCheck in a separate thread, that
periodically calls BackgroundCheck.check and upon completion
calls the provided callback.run()
|
protected void |
triggerBackgroundCheck()
for testing only!
|
protected final org.slf4j.Logger logger
protected java.lang.String slingId
protected org.apache.sling.discovery.commons.providers.spi.base.AbstractServiceWithBackgroundCheck.BackgroundCheckRunnable backgroundCheckRunnable
protected void cancelPreviousBackgroundCheck()
protected void startBackgroundCheck(java.lang.String threadName, org.apache.sling.discovery.commons.providers.spi.base.AbstractServiceWithBackgroundCheck.BackgroundCheck check, java.lang.Runnable callback, long timeoutMillis, long waitMillis)
threadName
- the name of the thread (to allow identifying the thread)check
- the BackgroundCheck to periodically invoke with check()callback
- the Runnable to invoke upon a successful check()timeoutMillis
- a timeout at which point the BackgroundCheck is
terminated and no callback is invoked. Note that this happens unnoticed
at the moment, ie there is no feedback about whether a background
check was successfully termianted (ie callback was invoked) or
whether the timeout has hit (that's left as a TODO if needed).protected void triggerBackgroundCheck()
Copyright © 2018 The Apache Software Foundation. All rights reserved.