2  * Copyright 2016-2017, Nokia Corporation
 
   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.
 
  17 package org.onap.vfc.nfvo.driver.vnfm.svnfm.adaptor;
 
  19 import java.util.List;
 
  20 import java.util.Timer;
 
  21 import java.util.TimerTask;
 
  22 import java.util.concurrent.atomic.AtomicInteger;
 
  24 import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.AffectedVnfc;
 
  26 public class OperateTaskProgress {
 
  27         private static AtomicInteger instantiate_progress = new AtomicInteger(10);
 
  28         private static AtomicInteger terminate_progress = new AtomicInteger(20);
 
  30         private static Timer instantiateTimer;
 
  31         private static Timer terminateTimer;
 
  33         private static List<AffectedVnfc> affectedVnfc;
 
  35         public static int getInstantiateProgress() {
 
  36                 return instantiate_progress.intValue();
 
  39         public static int getTerminateProgress() {
 
  40                 return terminate_progress.intValue();
 
  43         public static void incrementInstantiateProgress() {
 
  44                 instantiate_progress.incrementAndGet();
 
  47         public static void incrementTerminateProgress() {
 
  48                 terminate_progress.incrementAndGet();
 
  51         public static void startInstantiateTimerTask() {
 
  52                 instantiateTimer = new Timer();
 
  53                 instantiate_progress.set(10);
 
  54                 instantiateTimer.schedule(new TimerTask() {
 
  58                                 if(instantiate_progress.intValue() < 96) {
 
  59                                         instantiate_progress.incrementAndGet();
 
  66         public static void startTerminateTimerTask() {
 
  67                 terminateTimer = new Timer();
 
  68                 terminate_progress.set(20);
 
  69                 terminateTimer.schedule(new TimerTask() {
 
  73                                 if(terminate_progress.intValue() < 96) {
 
  74                                     terminate_progress.incrementAndGet();
 
  81         public static void stopTerminateTimerTask() {
 
  82                 terminateTimer.cancel();
 
  83                 terminate_progress.set(100);
 
  86         public static void stopInstantiateTimerTask() {
 
  87                 instantiateTimer.cancel();
 
  88                 instantiate_progress.set(100);
 
  91         public static List<AffectedVnfc> getAffectedVnfc() {
 
  95         public static void setAffectedVnfc(List<AffectedVnfc> affectedVnfc) {
 
  96                 OperateTaskProgress.affectedVnfc = affectedVnfc;