2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.objcache.guava;
10 import com.google.common.base.FinalizableReferenceQueue;
11 import javax.annotation.Nonnull;
12 import org.opendaylight.yangtools.objcache.ObjectCache;
13 import org.opendaylight.yangtools.objcache.spi.IObjectCacheFactory;
15 public final class GuavaObjectCacheFactory implements AutoCloseable, IObjectCacheFactory {
16 private static final GuavaObjectCacheFactory INSTANCE = new GuavaObjectCacheFactory();
17 private final FinalizableReferenceQueue queue = new FinalizableReferenceQueue();
18 private final ObjectCache cache;
20 private GuavaObjectCacheFactory() {
21 // FIXME: make this more dynamic using a spec
22 this.cache = new GuavaObjectCache(queue);
26 public ObjectCache getObjectCache(@Nonnull final Class<?> objClass) {
36 * Return a factory instance.
38 * @return A factory instance.
40 public static GuavaObjectCacheFactory getInstance() {