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.bgp.parser.spi.pojo;
10 import java.util.ServiceLoader;
12 import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator;
13 import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
15 public final class ServiceLoaderBGPExtensionProviderContext {
16 private static final class Holder {
17 private static final BGPExtensionProviderContext INSTANCE;
22 } catch (final Exception e) {
23 throw new ExceptionInInitializerError(e);
28 public static BGPExtensionProviderContext create() throws Exception {
29 final BGPExtensionProviderContext ctx = new SimpleBGPExtensionProviderContext();
31 final ServiceLoader<BGPExtensionProviderActivator> loader = ServiceLoader
32 .load(BGPExtensionProviderActivator.class);
33 for (BGPExtensionProviderActivator a : loader) {
40 public static BGPExtensionProviderContext getSingletonInstance() {
41 return Holder.INSTANCE;
44 private ServiceLoaderBGPExtensionProviderContext() {