7311: Switch to logging a warning instead of throwing an exception when initializing PeerTaskFeatureToggle multiple times

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
pull/7633/head
Matilda Clerke 2 months ago
parent ace5dd1918
commit 52d440afbe
  1. 10
      besu/src/main/java/org/hyperledger/besu/cli/custom/PeerTaskFeatureToggle.java

@ -14,11 +14,15 @@
*/
package org.hyperledger.besu.cli.custom;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Temporary class to allow easy access to the PeerTask feature toggle. This class can be removed
* once we've properly tested the PeerTask system and want to enable it permanently
*/
public class PeerTaskFeatureToggle {
private static final Logger LOGGER = LoggerFactory.getLogger(PeerTaskFeatureToggle.class);
private static Boolean USE_PEER_TASK_SYSTEM = null;
/**
@ -30,10 +34,10 @@ public class PeerTaskFeatureToggle {
*/
public static void initialize(final Boolean usePeerTaskSystem) {
if (USE_PEER_TASK_SYSTEM != null) {
throw new IllegalStateException(
"PeerTaskFeatureToggle has already been initialized, and cannot be initialized again");
LOGGER.warn("PeerTaskFeatureToggle has already been initialized, and cannot be initialized again");
} else {
USE_PEER_TASK_SYSTEM = usePeerTaskSystem;
}
USE_PEER_TASK_SYSTEM = usePeerTaskSystem;
}
/**

Loading…
Cancel
Save