![JAR search and dependency download from the Maven repository](/logo.png)
org.wildfly.clustering.ejb.cache.timer.DefaultTimerMetaData Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wildfly-clustering-ejb-cache Show documentation
Show all versions of wildfly-clustering-ejb-cache Show documentation
Contains code common to the wildfly-clustering-ejb-hotrod and wildfly-clustering-ejb-infinispan modules.
/*
* Copyright The WildFly Authors
* SPDX-License-Identifier: Apache-2.0
*/
package org.wildfly.clustering.ejb.cache.timer;
import java.time.Duration;
import java.time.Instant;
import org.wildfly.clustering.cache.CacheEntryMutator;
import org.wildfly.clustering.ejb.timer.TimerMetaData;
/**
* A timer metadata implementation that triggers a mutator on {@link #setLastTimeout(Instant)}.
* @author Paul Ferraro
* @param the timer context type
*/
public class DefaultTimerMetaData extends DefaultImmutableTimerMetaData implements TimerMetaData {
private final TimerMetaDataEntry entry;
private final CacheEntryMutator mutator;
public DefaultTimerMetaData(TimerMetaDataConfiguration configuration, TimerMetaDataEntry entry, CacheEntryMutator mutator) {
super(configuration, entry);
this.entry = entry;
this.mutator = mutator;
}
@Override
public void setLastTimeout(Instant timeout) {
this.entry.setLastTimeout((timeout != null) ? Duration.between(this.entry.getStart(), timeout) : null);
this.mutator.mutate();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy