2 * Copyright (c) 2013 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.protocol.pcep.spi.pojo;
10 import java.util.ServiceLoader;
12 import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator;
13 import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext;
15 public final class ServiceLoaderPCEPExtensionProviderContext extends SimplePCEPExtensionProviderContext {
16 private static final class Holder {
17 private static final PCEPExtensionProviderContext INSTANCE;
22 } catch (final Exception e) {
23 throw new ExceptionInInitializerError(e);
28 private ServiceLoaderPCEPExtensionProviderContext() {
32 public static PCEPExtensionProviderContext create() throws Exception {
33 final PCEPExtensionProviderContext ctx = new SimplePCEPExtensionProviderContext();
35 final ServiceLoader<PCEPExtensionProviderActivator> loader = ServiceLoader.load(PCEPExtensionProviderActivator.class);
36 for (final PCEPExtensionProviderActivator a : loader) {
43 public static PCEPExtensionProviderContext getSingletonInstance() {
44 return Holder.INSTANCE;