2 * Copyright (c) 2013, 2017 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.controller.config.manager.testingservices.parallelapsp;
10 import static com.google.common.base.Preconditions.checkArgument;
12 import com.google.common.base.Strings;
13 import java.io.Closeable;
14 import java.io.IOException;
15 import javax.annotation.concurrent.NotThreadSafe;
16 import org.opendaylight.controller.config.manager.testingservices.threadpool.TestingThreadPoolIfc;
19 public class TestingParallelAPSPImpl implements TestingAPSP, Closeable {
20 public static final int MINIMAL_NUMBER_OF_THREADS = 10;
21 private final TestingThreadPoolIfc threadPool;
22 private String someParam;
24 public TestingParallelAPSPImpl(final TestingThreadPoolIfc threadPool,
25 final String someParam) {
27 threadPool.getMaxNumberOfThreads() >= MINIMAL_NUMBER_OF_THREADS,
28 "Parameter 'threadPool' has not enough threads");
29 checkArgument(Strings.isNullOrEmpty(someParam) == false,
30 "Parameter 'someParam' is blank");
31 this.threadPool = threadPool;
32 this.someParam = someParam;
36 public int getMaxNumberOfThreads() {
37 return threadPool.getMaxNumberOfThreads();
41 public void close() throws IOException {
45 TestingThreadPoolIfc getThreadPool() {
49 void setSomeParam(final String string) {
50 checkArgument(Strings.isNullOrEmpty(someParam) == false,
51 "Parameter 'someParam' is blank");
52 this.someParam = string;
55 public String getSomeParam() {