X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-clustering-commons%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fnode%2Futils%2FQNameFactory.java;h=5c7f6d1a5650333ca1cee7124ff0edd47a8c0378;hb=8e3fb7b97f23fe0aba388b295fbe45d67d21e91c;hp=c63266ff08e218fc6180fdf1cae61e990677eace;hpb=6bcc799fb62c2e4572f11134a601e7ea2a4651cf;p=controller.git diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/QNameFactory.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/QNameFactory.java index c63266ff08..5c7f6d1a56 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/QNameFactory.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/QNameFactory.java @@ -1,11 +1,9 @@ /* + * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved. * - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.controller.cluster.datastore.node.utils; @@ -15,24 +13,22 @@ import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; import org.opendaylight.yangtools.yang.common.QName; -public class QNameFactory { +public final class QNameFactory { private static final int MAX_QNAME_CACHE_SIZE = 10000; - private static final LoadingCache CACHE = CacheBuilder.newBuilder() - .maximumSize(MAX_QNAME_CACHE_SIZE) - .softValues() - .build( - new CacheLoader() { + private QNameFactory() { + } + + private static final LoadingCache CACHE = CacheBuilder.newBuilder().maximumSize(MAX_QNAME_CACHE_SIZE) + .softValues().build(new CacheLoader() { @Override public QName load(String key) { return QName.create(key); } - } - ); - + }); - public static QName create(String name){ + public static QName create(String name) { return CACHE.getUnchecked(name); } }