public abstract class AbstractRemoteResourceHandler extends Object implements Serializable, Runnable, Supplier<Tuple>
It is used to implement atomic or incremental variant to periodically reload remote resources.
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractRemoteResourceHandler.AtomicTupleReference
The result fetched by caller.
|
Modifier and Type | Field and Description |
---|---|
protected AtomicReference<AbstractRemoteResourceHandler.AtomicTupleReference> |
atomicTupleReference
The result that holds the fetched resource
|
protected IResourceBuilder |
builder |
protected static org.apache.logging.log4j.Logger |
logger |
protected boolean |
requiredResource
If true, the get resource must be loaded first before any first retrieval.
|
protected String |
resourceUuid |
Constructor and Description |
---|
AbstractRemoteResourceHandler(String resourceUuid,
IResourceBuilder builder,
String cron,
boolean requiredResource,
boolean silent,
org.thales.punch.libraries.metrics.api.IMetricContext mc)
Ctor using a plain HTTP HTTPS or file URL.
|
Modifier and Type | Method and Description |
---|---|
static void |
clear()
Test method to clear the resources after some tests
|
Tuple |
get() |
protected void |
loadingFailures() |
protected void |
loadingSuccess() |
abstract void |
reload() |
void |
run() |
Supplier<Tuple> |
start() |
protected com.codahale.metrics.Timer.Context |
startLoading() |
void |
stop() |
protected static void |
stopLoading(com.codahale.metrics.Timer.Context c) |
protected transient IResourceBuilder builder
protected static final org.apache.logging.log4j.Logger logger
protected String resourceUuid
protected final boolean requiredResource
protected final AtomicReference<AbstractRemoteResourceHandler.AtomicTupleReference> atomicTupleReference
public AbstractRemoteResourceHandler(String resourceUuid, IResourceBuilder builder, String cron, boolean requiredResource, boolean silent, org.thales.punch.libraries.metrics.api.IMetricContext mc)
resourceUuid
- the remote or local resource URLcron
- the CRON expression. If null no thread is launched.builder
- the resource builder in charge of transforming the loaded resourcesrequiredResource
- true to make it mandatory to load the resource firstmc
- the metrics contextprotected com.codahale.metrics.Timer.Context startLoading()
protected static void stopLoading(com.codahale.metrics.Timer.Context c)
protected void loadingFailures()
protected void loadingSuccess()
public void stop()
public static void clear()
public abstract void reload() throws IOException
IOException
Copyright © 2022. All rights reserved.