11#include <Poco/Thread.h>
17 declareProperty(
"Session",
"",
"The session information of the catalog to use.");
18 declareProperty<int>(
"TimePeriod", 1200,
"Frequency to refresh session in seconds. Default 1200 (20 minutes).",
25 throw std::runtime_error(
"TimePeriod must be greater than zero.");
27 Types::Core::DateAndTime lastTimeExecuted = Types::Core::DateAndTime::getCurrentTime();
31 Poco::Thread::sleep(1000);
36 double secondsSinceExecuted =
37 Types::Core::DateAndTime::secondsFromDuration(Types::Core::DateAndTime::getCurrentTime() - lastTimeExecuted);
39 if (secondsSinceExecuted > timePeriod) {
41 lastTimeExecuted = Types::Core::DateAndTime::getCurrentTime();
#define DECLARE_ALGORITHM(classname)
std::string getPropertyValue(const std::string &name) const override
Get the value of a property as a string.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
void interruption_point()
This is called during long-running operations, and check if the algorithm has requested that it be ca...
CatalogKeepAlive is responsible for keeping a catalog alive based on the session information.
void exec() override
Override algorithm execute method.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
@ Input
An input workspace.