Package io.jans.fido2.service.metric
Class Fido2MetricsAggregationScheduler
java.lang.Object
io.jans.fido2.service.metric.Fido2MetricsAggregationScheduler
Scheduler service for FIDO2 metrics aggregation
- Author:
- FIDO2 Team
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classJob for daily aggregation Uses distributed locking to ensure only one node performs aggregationstatic classJob for data cleanupstatic classJob for hourly aggregation This job is designed to work in cluster environments where nodes can be added/removed All statistics are persisted to the database, not kept in memory Uses distributed locking to ensure only one node performs aggregationstatic classJob for monthly aggregation Uses distributed locking to ensure only one node performs aggregationstatic classJob for weekly aggregation Uses distributed locking to ensure only one node performs aggregation -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidEnsure all pending metrics are persisted to database This method should be called before node shutdown or during maintenanceintGet data retention daysvoidInitialize and register Quartz jobs for metrics aggregation Called during application startup by AppInitializerbooleanCheck if aggregation is enabledvoidCleanup resources on shutdown Shuts down update executor if in cluster modebooleanCheck if this node should perform the aggregation In single-node deployments: always returns true In multi-node clusters: uses distributed locking to coordinate Synchronized to prevent race conditions between concurrent job threadsStart periodic updates to keep the lock alive during aggregation work Should be called at the start of aggregation work Only used in cluster environments
-
Constructor Details
-
Fido2MetricsAggregationScheduler
public Fido2MetricsAggregationScheduler()
-
-
Method Details
-
isAggregationEnabled
public boolean isAggregationEnabled()Check if aggregation is enabled -
getDataRetentionDays
public int getDataRetentionDays()Get data retention days -
flushPendingMetrics
public void flushPendingMetrics()Ensure all pending metrics are persisted to database This method should be called before node shutdown or during maintenance -
shouldPerformAggregation
public boolean shouldPerformAggregation()Check if this node should perform the aggregation In single-node deployments: always returns true In multi-node clusters: uses distributed locking to coordinate Synchronized to prevent race conditions between concurrent job threads -
startPeriodicLockUpdates
Start periodic updates to keep the lock alive during aggregation work Should be called at the start of aggregation work Only used in cluster environments- Returns:
- ScheduledFuture that can be used to cancel the updates, or null if not in cluster
-
initTimer
public void initTimer()Initialize and register Quartz jobs for metrics aggregation Called during application startup by AppInitializer -
releaseClusterNode
@PreDestroy public void releaseClusterNode()Cleanup resources on shutdown Shuts down update executor if in cluster mode
-