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

Alachisoft.NCache.Common.Messaging.SubscriptionInfo Maven / Gradle / Ivy

There is a newer version: 5.3.3
Show newest version
package Alachisoft.NCache.Common.Messaging;

import Alachisoft.NCache.Common.Enum.SubscriptionType;
import com.alachisoft.ncache.runtime.caching.SubscriptionPolicyType;
import com.alachisoft.ncache.runtime.util.TimeSpan;

import java.util.Date;

import static com.alachisoft.ncache.runtime.util.NCDateTime.getUTCNow;

public class SubscriptionInfo {
    public static final String EventsSubscriptionName = "$EventsSubscription$";
    private String _subscriptionId;
    private String _clientId;
    private SubscriptionType _type;
    private SubscriptionPolicyType _subscriptionPolicy;
    private long _expiration;
    private long _creationTime;
    private Date absoluteExpiratoinTime;

    public String getSubscriptionId() {
        return _subscriptionId;
    }

    public void setSubscriptionId(String value) {
        _subscriptionId = value;
    }

    public String getClientId() {
        return _clientId;
    }

    public void setClientId(String value) {
        _clientId = value;
    }

    public SubscriptionType getType() {
        return _type;
    }

    public void setType(SubscriptionType value) {
        _type = value;
    }

    public SubscriptionPolicyType getSubPolicyType() {
        return _subscriptionPolicy;
    }

    public void setSubPolicyType(SubscriptionPolicyType value) {
        _subscriptionPolicy = value;
    }

    public long getExpiration() {
        return _expiration;
    }

    public void setExpiration(long value) {
        _expiration = value;
    }

    public long getCreationTime() {
        return _creationTime;
    }

    public void setCreationTime(long value) {
        _creationTime = value;
    }

    public Date initializeExpiration() {
        setAbsoluteExpiratoinTime(new Date(getUTCNow().getTime() + getExpiration()));
        return getAbsoluteExpiratoinTime();
    }

    public boolean expirationCheck() {
        long expCheck = TimeSpan.MaxValue.getTotalTicks();
        if (expCheck != _expiration) {
            return true;
        } else {
            return false;
        }
    }

    public Date getAbsoluteExpiratoinTime() {
        return absoluteExpiratoinTime;
    }

    private void setAbsoluteExpiratoinTime(Date value) {
        absoluteExpiratoinTime = value;
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy