2 * Copyright 2017 BOCO Corporation. CMCC Technologies Co., Ltd
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.onap.vfc.nfvo.emsdriver;
18 import org.apache.commons.logging.Log;
19 import org.apache.commons.logging.LogFactory;
20 import org.onap.vfc.nfvo.emsdriver.commons.constant.Constant;
21 import org.onap.vfc.nfvo.emsdriver.commons.utils.DriverThread;
22 import org.onap.vfc.nfvo.emsdriver.northbound.service.EmsDriverApplication;
23 import org.springframework.beans.BeansException;
24 import org.springframework.context.ApplicationContext;
25 import org.springframework.context.support.FileSystemXmlApplicationContext;
29 public class EMSDriverApp {
31 private static Log log = LogFactory.getLog(DriverThread.class);
32 public static ApplicationContext context = null;
35 /** spring bean applicationContext **/
36 context = new FileSystemXmlApplicationContext("file:" + Constant.SYS_CFG+ "spring.xml");
38 } catch (BeansException e) {
39 log.error("spring.xml is fail ", e);
41 } catch (Exception e) {
42 log.error("spring.xml is fail", e);
51 public static void main(String[] args) {
52 String[] allThreadName = context.getBeanNamesForType(DriverThread.class);
54 log.info("worker num :" + allThreadName.length);
56 for (String threadName : allThreadName) {
57 DriverThread thread = (DriverThread) context.getBean(threadName);
59 log.error(threadName + "Thread start error,system exit");
62 thread.setName(threadName);
67 new EmsDriverApplication().run(args);
68 } catch (Exception e) {
69 log.error("EmsDriverApplication.run is fail", e);
72 log.info("the workerThreads start sucess" );