Class AggregationScheduler
java.lang.Object
org.gcube.documentstore.records.aggregation.AggregationScheduler
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
BufferAggregationScheduler
- Author:
- Luca Frosini (ISTI - CNR)
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Filestatic final Stringstatic final Stringstatic final Stringbooleanstatic final Stringstatic final Stringprotected ScheduledFuture<?>protected ScheduledFuture<?>static final org.slf4j.Loggerprotected final PersistenceExecutorstatic final intstatic final longThe Max amount of time for reload a configuration Get from configurationprotected int -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAggregationScheduler(PersistenceExecutor persistenceExecutor) protectedAggregationScheduler(PersistenceExecutor persistenceExecutor, AggregationConfiguration config) -
Method Summary
Modifier and TypeMethodDescriptionvoidaggregate(Record record, PersistenceExecutor persistenceExecutor) Get a record and try to aggregate with other buffered Records.protected voidaggregate(Record record, PersistenceExecutor persistenceExecutor, boolean forceFlush) protected static AggregationConfigurationCheckConfiguration(PersistenceBackendConfiguration configuration) protected voidclear()voidflush(PersistenceExecutor persistenceExecutor) static AggregatedRecordgetAggregatedRecord(Record record) protected PersistenceBackendConfigurationGet Configuration (used from reload configuration)static Propertiesprotected static AggregatedRecordinstantiateAggregatedRecord(Record record) protected abstract booleanisTimeToPersist(int maxRecordNumber, long oldRecordMaxTime) protected voidmadeAggregation(Record record) static AggregationSchedulernewInstance(PersistenceExecutor persistenceExecutor) static AggregationSchedulernewInstance(PersistenceExecutor persistenceExecutor, PersistenceBackendConfiguration configuration) protected voidreallyFlush(PersistenceExecutor persistenceExecutor) protected voidreloadConfigurationvoidrun()protected abstract voidvoidsetConfig(AggregationConfiguration newConfig) voidshutdown()
-
Field Details
-
logger
public static final org.slf4j.Logger logger -
AGGREGATION_SCHEDULER_TIME
- See Also:
-
BUFFER_RECORD_TIME
- See Also:
-
BUFFER_RECORD_NUMBER
- See Also:
-
RANDOM_INIT_START
public static final int RANDOM_INIT_START- See Also:
-
TIME_RELOAD_CONFIGURATION
public static final long TIME_RELOAD_CONFIGURATIONThe Max amount of time for reload a configuration Get from configuration- See Also:
-
CONFIG_DIRECTORY_NAME
- See Also:
-
FILE_NAME
- See Also:
-
AGGREGATION_PROPERTIES_FILE
-
totalBufferedRecords
protected int totalBufferedRecords -
bufferedRecords
-
persistenceExecutor
-
changeConfiguration
public boolean changeConfiguration -
futureFlush
-
futureReload
-
-
Constructor Details
-
AggregationScheduler
-
AggregationScheduler
protected AggregationScheduler(PersistenceExecutor persistenceExecutor, AggregationConfiguration config)
-
-
Method Details
-
newInstance
-
newInstance
public static AggregationScheduler newInstance(PersistenceExecutor persistenceExecutor, PersistenceBackendConfiguration configuration) throws NumberFormatException, Exception - Throws:
NumberFormatExceptionException
-
instantiateAggregatedRecord
- Throws:
Exception
-
getAggregatedRecord
- Throws:
Exception
-
madeAggregation
-
flush
- Throws:
Exception
-
schedulerSpecificClear
protected abstract void schedulerSpecificClear() -
clear
protected void clear() -
aggregate
protected void aggregate(Record record, PersistenceExecutor persistenceExecutor, boolean forceFlush) throws Exception - Throws:
Exception
-
reallyFlush
- Throws:
Exception
-
aggregate
Get a record and try to aggregate with other buffered Records.- Parameters:
record- The RecordpersistenceExecutor-- Throws:
Exception
-
isTimeToPersist
protected abstract boolean isTimeToPersist(int maxRecordNumber, long oldRecordMaxTime) -
reloadConfiguration
protected void reloadConfiguration()reloadConfiguration -
getConfiguration
Get Configuration (used from reload configuration)- Returns:
- PersistenceBackendConfiguration
-
getPropertiesFromFile
- Throws:
IOException
-
CheckConfiguration
protected static AggregationConfiguration CheckConfiguration(PersistenceBackendConfiguration configuration) throws IOException - Throws:
IOException
-
getConfig
-
setConfig
-
run
public void run() -
shutdown
public void shutdown()
-