package org.ehcache.impl.internal.store.heap.holders;
import org.ehcache.core.spi.store.AbstractValueHolder;
import java.util.concurrent.TimeUnit;
public abstract class OnHeapValueHolder<V> extends AbstractValueHolder<V> {
private final boolean evictionAdvice;
private long size;
protected OnHeapValueHolder(long id, long creationTime, boolean evictionAdvice) {
super(id, creationTime);
this.evictionAdvice = evictionAdvice;
}
protected OnHeapValueHolder(long id, long creationTime, long expirationTime, boolean evictionAdvice) {
super(id, creationTime, expirationTime);
this.evictionAdvice = evictionAdvice;
}
public boolean evictionAdvice() {
return evictionAdvice;
}
public long size() {
return this.size;
}
public void setSize(long size) {
if (this.size != 0) {
throw new UnsupportedOperationException("Cannot change the size if it is done already");
}
this.size = size;
}
@Override
public boolean equals(Object obj) {
if (obj != null && this.getClass().equals(obj.getClass())) {
return super.equals(obj);
}
return false;
}
}