* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
+ * ================================================================================
+ * Modifications Copyright (C) 2019 Ericsson
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.onap.appc.configuration.Configuration;
import org.onap.appc.configuration.ConfigurationFactory;
-
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
public class Util {
- private int default_queue_size = 10;
- private int default_threadpool_size = 10;
- private String queue_size_key = "appc.dispatcher.executionqueue.backlog.size";
- private String threadpool_size_key = "appc.dispatcher.executionqueue.threadpool.size";
+ private int defaultQueueSize = 10;
+ private int defaultThreadpoolSize = 10;
+ private String queueSizeKey = "appc.dispatcher.executionqueue.backlog.size";
+ private String threadpoolSizeKey = "appc.dispatcher.executionqueue.threadpool.size";
+ private EELFLogger logger = EELFManager.getInstance().getLogger(Util.class);
private Configuration configuration;
}
public int getExecutionQueueSize() {
- String sizeStr = configuration.getProperty(queue_size_key, String.valueOf(default_queue_size));
+ String sizeStr = configuration.getProperty(queueSizeKey, String.valueOf(defaultQueueSize));
- int size = default_queue_size;
+ int size = defaultQueueSize;
try {
size = Integer.parseInt(sizeStr);
} catch (NumberFormatException e) {
-
+ logger.error("Error parsing dispatcher execution queue backlog size", e);
}
return size;
}
public int getThreadPoolSize() {
- String sizeStr = configuration.getProperty(threadpool_size_key, String.valueOf(default_threadpool_size));
+ String sizeStr = configuration.getProperty(threadpoolSizeKey, String.valueOf(defaultThreadpoolSize));
- int size = default_threadpool_size;
+ int size = defaultThreadpoolSize;
try {
size = Integer.parseInt(sizeStr);
} catch (NumberFormatException e) {
-
+ logger.error("Error parsing dispatcher execution queue threadpool size", e);
}
return size;