All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.wildfly.clustering.ejb.cache.bean.DefaultImmutableBeanMetaData Maven / Gradle / Ivy

/*
 * Copyright The WildFly Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package org.wildfly.clustering.ejb.cache.bean;

import java.time.Duration;
import java.time.Instant;

import org.wildfly.clustering.ejb.bean.BeanExpiration;
import org.wildfly.clustering.ejb.bean.ImmutableBeanMetaData;

/**
 * @author Paul Ferraro
 */
public class DefaultImmutableBeanMetaData implements ImmutableBeanMetaData {

    private final ImmutableBeanMetaDataEntry entry;
    private final BeanExpiration expiration;

    public DefaultImmutableBeanMetaData(ImmutableBeanMetaDataEntry entry, BeanExpiration expiration) {
        this.entry = entry;
        this.expiration = expiration;
    }

    @Override
    public Duration getTimeout() {
        return (this.expiration != null) ? this.expiration.getTimeout() : null;
    }

    @Override
    public Instant getLastAccessTime() {
        return this.entry.getLastAccess().get();
    }

    @Override
    public String getName() {
        return this.entry.getName();
    }

    @Override
    public K getGroupId() {
        return this.entry.getGroupId();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy