replace our SystemReadyBaseImpl with infrautils' SystemReadyImpl
authorMichael Vorburger <mike@vorburger.ch>
Mon, 1 Oct 2018 12:33:47 +0000 (14:33 +0200)
committerMichael Vorburger <mike@vorburger.ch>
Wed, 1 Jul 2020 23:37:19 +0000 (01:37 +0200)
see https://git.opendaylight.org/gerrit/#/c/76532/

Signed-off-by: Michael Vorburger <mike@vorburger.ch>
src/main/java/org/opendaylight/infrautils/ready/SystemReadyBaseImpl.java [deleted file]
src/main/java/org/opendaylight/infrautils/simple/ReadyWiring.java

diff --git a/src/main/java/org/opendaylight/infrautils/ready/SystemReadyBaseImpl.java b/src/main/java/org/opendaylight/infrautils/ready/SystemReadyBaseImpl.java
deleted file mode 100644 (file)
index 6ee9543..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2017 Red Hat, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.infrautils.ready;
-
-import static org.opendaylight.infrautils.ready.SystemState.BOOTING;
-
-import java.util.Queue;
-import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.atomic.AtomicReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Basic implementation of {@link SystemReadyMonitor}.
- *
- * @author Michael Vorburger.ch
- */
-public class SystemReadyBaseImpl implements SystemReadyMonitor {
-
-    private static final Logger LOG = LoggerFactory.getLogger(SystemReadyBaseImpl.class);
-
-    // TODO SystemReadyImpl should extend this.. but quid AbstractMXBean?
-
-    private final Queue<SystemReadyListener> listeners = new ConcurrentLinkedQueue<>();
-    private final AtomicReference<SystemState> systemState = new AtomicReference<>(BOOTING);
-
-    @Override
-    public SystemState getSystemState() {
-        return systemState.get();
-    }
-
-    @Override
-    public void registerListener(SystemReadyListener listener) {
-        listeners.add(listener);
-    }
-
-    @Override
-    public String getFailureCause() {
-        // This doesn't fail
-        return "";
-    }
-
-    @SuppressWarnings("checkstyle:IllegalCatch")
-    public void ready() {
-        for (SystemReadyListener systemReadyListener : listeners) {
-            try {
-                systemReadyListener.onSystemBootReady();
-            } catch (Exception e) {
-                LOG.error("onSystemBootReady() on a SystemReadyListener failed", e);
-            }
-        }
-        systemState.set(SystemState.ACTIVE);
-    }
-}
index d69455d06a8cef5afc806b6737563b21bd7e97e3..065d14ad582c56152249f700f22041d621e4c562 100644 (file)
@@ -9,13 +9,13 @@ package org.opendaylight.infrautils.simple;
 
 import com.google.inject.AbstractModule;
 import org.opendaylight.infrautils.inject.PostFullSystemInjectionListener;
-import org.opendaylight.infrautils.ready.SystemReadyBaseImpl;
 import org.opendaylight.infrautils.ready.SystemReadyMonitor;
+import org.opendaylight.infrautils.ready.impl.SystemReadyImpl;
 import org.ops4j.pax.cdi.api.OsgiService;
 
 public class ReadyWiring extends AbstractModule implements PostFullSystemInjectionListener {
 
-    private final SystemReadyBaseImpl systemReadyImpl = new SystemReadyBaseImpl();
+    private final SystemReadyImpl systemReadyImpl = new SystemReadyImpl();
 
     @Override
     protected void configure() {