package org.opendaylight.protocol.rsvp.parser.spi.pojo;
-import com.google.common.base.Preconditions;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import java.util.concurrent.atomic.AtomicReference;
this.cacheRef = new AtomicReference<Cache<Object,Object>>(cache);
}
- public final synchronized int getMaximumCachedObjects() {
- return this.maximumCachedObjects;
- }
-
- public final synchronized void setMaximumCachedObjects(final int maximumCachedObjects) {
- Preconditions.checkArgument(maximumCachedObjects >= 0);
-
- final Cache<Object, Object> newCache = CacheBuilder.newBuilder().maximumSize(maximumCachedObjects).build();
- newCache.putAll(this.cacheRef.get().asMap());
- this.cacheRef.set(newCache);
- }
-
@Override
public ReferenceCache getReferenceCache() {
return this.referenceCache;