From 7079a7047901ae4547b697e9f3c872b737261864 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Pi=C3=B1a?= Date: Wed, 31 Jan 2024 11:59:23 -0500 Subject: [PATCH] chore: change packages --- .../littlehorse/canary/{app => }/Bootstrap.java | 2 +- .../io/littlehorse/canary/CanaryException.java | 17 +++++++++++++++++ .../main/java/io/littlehorse/canary/Main.java | 1 - .../canary/aggregator/AggregatorBootstrap.java | 2 +- .../canary/app/InitializationException.java | 17 ----------------- .../canary/kafka/KafkaBootstrap.java | 6 +++--- .../canary/kafka/MetricsEmitter.java | 3 ++- .../canary/kafka/MetricsEmitterException.java | 17 ----------------- .../canary/metronome/MetronomeBootstrap.java | 2 +- .../canary/metronome/WorkerBootstrap.java | 8 ++++---- 10 files changed, 29 insertions(+), 46 deletions(-) rename canary/src/main/java/io/littlehorse/canary/{app => }/Bootstrap.java (80%) create mode 100644 canary/src/main/java/io/littlehorse/canary/CanaryException.java delete mode 100644 canary/src/main/java/io/littlehorse/canary/app/InitializationException.java delete mode 100644 canary/src/main/java/io/littlehorse/canary/kafka/MetricsEmitterException.java diff --git a/canary/src/main/java/io/littlehorse/canary/app/Bootstrap.java b/canary/src/main/java/io/littlehorse/canary/Bootstrap.java similarity index 80% rename from canary/src/main/java/io/littlehorse/canary/app/Bootstrap.java rename to canary/src/main/java/io/littlehorse/canary/Bootstrap.java index e8010f38b..e0455cd45 100644 --- a/canary/src/main/java/io/littlehorse/canary/app/Bootstrap.java +++ b/canary/src/main/java/io/littlehorse/canary/Bootstrap.java @@ -1,4 +1,4 @@ -package io.littlehorse.canary.app; +package io.littlehorse.canary; import io.littlehorse.canary.config.CanaryConfig; diff --git a/canary/src/main/java/io/littlehorse/canary/CanaryException.java b/canary/src/main/java/io/littlehorse/canary/CanaryException.java new file mode 100644 index 000000000..cceb74544 --- /dev/null +++ b/canary/src/main/java/io/littlehorse/canary/CanaryException.java @@ -0,0 +1,17 @@ +package io.littlehorse.canary; + +public class CanaryException extends RuntimeException { + public CanaryException() {} + + public CanaryException(String message) { + super(message); + } + + public CanaryException(String message, Throwable cause) { + super(message, cause); + } + + public CanaryException(Throwable cause) { + super(cause); + } +} diff --git a/canary/src/main/java/io/littlehorse/canary/Main.java b/canary/src/main/java/io/littlehorse/canary/Main.java index 684643ba1..7982183c0 100644 --- a/canary/src/main/java/io/littlehorse/canary/Main.java +++ b/canary/src/main/java/io/littlehorse/canary/Main.java @@ -2,7 +2,6 @@ import com.google.common.collect.Lists; import io.littlehorse.canary.aggregator.AggregatorBootstrap; -import io.littlehorse.canary.app.Bootstrap; import io.littlehorse.canary.config.CanaryConfig; import io.littlehorse.canary.config.ConfigLoader; import io.littlehorse.canary.kafka.KafkaBootstrap; diff --git a/canary/src/main/java/io/littlehorse/canary/aggregator/AggregatorBootstrap.java b/canary/src/main/java/io/littlehorse/canary/aggregator/AggregatorBootstrap.java index 2385b9859..1c94501e5 100644 --- a/canary/src/main/java/io/littlehorse/canary/aggregator/AggregatorBootstrap.java +++ b/canary/src/main/java/io/littlehorse/canary/aggregator/AggregatorBootstrap.java @@ -1,7 +1,7 @@ package io.littlehorse.canary.aggregator; import com.google.protobuf.InvalidProtocolBufferException; -import io.littlehorse.canary.app.Bootstrap; +import io.littlehorse.canary.Bootstrap; import io.littlehorse.canary.config.CanaryConfig; import io.littlehorse.canary.proto.Metric; import io.littlehorse.canary.proto.StreamTopologyFailure; diff --git a/canary/src/main/java/io/littlehorse/canary/app/InitializationException.java b/canary/src/main/java/io/littlehorse/canary/app/InitializationException.java deleted file mode 100644 index 81b22a325..000000000 --- a/canary/src/main/java/io/littlehorse/canary/app/InitializationException.java +++ /dev/null @@ -1,17 +0,0 @@ -package io.littlehorse.canary.app; - -public class InitializationException extends RuntimeException { - public InitializationException() {} - - public InitializationException(String message) { - super(message); - } - - public InitializationException(String message, Throwable cause) { - super(message, cause); - } - - public InitializationException(Throwable cause) { - super(cause); - } -} diff --git a/canary/src/main/java/io/littlehorse/canary/kafka/KafkaBootstrap.java b/canary/src/main/java/io/littlehorse/canary/kafka/KafkaBootstrap.java index 810180ebd..aaebcfc1e 100644 --- a/canary/src/main/java/io/littlehorse/canary/kafka/KafkaBootstrap.java +++ b/canary/src/main/java/io/littlehorse/canary/kafka/KafkaBootstrap.java @@ -1,7 +1,7 @@ package io.littlehorse.canary.kafka; -import io.littlehorse.canary.app.Bootstrap; -import io.littlehorse.canary.app.InitializationException; +import io.littlehorse.canary.Bootstrap; +import io.littlehorse.canary.CanaryException; import io.littlehorse.canary.config.CanaryConfig; import java.util.List; import lombok.extern.slf4j.Slf4j; @@ -29,7 +29,7 @@ public void initialize(CanaryConfig config) { if (e.getCause() instanceof TopicExistsException) { log.warn(e.getMessage()); } else { - throw new InitializationException(e); + throw new CanaryException(e); } } log.trace("Initialized"); diff --git a/canary/src/main/java/io/littlehorse/canary/kafka/MetricsEmitter.java b/canary/src/main/java/io/littlehorse/canary/kafka/MetricsEmitter.java index 7561256f4..9cd3ba153 100644 --- a/canary/src/main/java/io/littlehorse/canary/kafka/MetricsEmitter.java +++ b/canary/src/main/java/io/littlehorse/canary/kafka/MetricsEmitter.java @@ -1,5 +1,6 @@ package io.littlehorse.canary.kafka; +import io.littlehorse.canary.CanaryException; import io.littlehorse.canary.config.CanaryConfig; import io.littlehorse.canary.proto.Metric; import java.io.Closeable; @@ -40,7 +41,7 @@ public RecordMetadata emit(String key, Metric metric) { try { return future(key, metric).get(); } catch (InterruptedException | ExecutionException e) { - throw new MetricsEmitterException(e); + throw new CanaryException(e); } } diff --git a/canary/src/main/java/io/littlehorse/canary/kafka/MetricsEmitterException.java b/canary/src/main/java/io/littlehorse/canary/kafka/MetricsEmitterException.java deleted file mode 100644 index 8e5498a37..000000000 --- a/canary/src/main/java/io/littlehorse/canary/kafka/MetricsEmitterException.java +++ /dev/null @@ -1,17 +0,0 @@ -package io.littlehorse.canary.kafka; - -public class MetricsEmitterException extends RuntimeException { - public MetricsEmitterException() {} - - public MetricsEmitterException(String message) { - super(message); - } - - public MetricsEmitterException(String message, Throwable cause) { - super(message, cause); - } - - public MetricsEmitterException(Throwable cause) { - super(cause); - } -} diff --git a/canary/src/main/java/io/littlehorse/canary/metronome/MetronomeBootstrap.java b/canary/src/main/java/io/littlehorse/canary/metronome/MetronomeBootstrap.java index 645c3e589..bf944cfb1 100644 --- a/canary/src/main/java/io/littlehorse/canary/metronome/MetronomeBootstrap.java +++ b/canary/src/main/java/io/littlehorse/canary/metronome/MetronomeBootstrap.java @@ -1,6 +1,6 @@ package io.littlehorse.canary.metronome; -import io.littlehorse.canary.app.Bootstrap; +import io.littlehorse.canary.Bootstrap; import io.littlehorse.canary.config.CanaryConfig; public class MetronomeBootstrap implements Bootstrap { diff --git a/canary/src/main/java/io/littlehorse/canary/metronome/WorkerBootstrap.java b/canary/src/main/java/io/littlehorse/canary/metronome/WorkerBootstrap.java index 82fb35a03..8a28723b2 100644 --- a/canary/src/main/java/io/littlehorse/canary/metronome/WorkerBootstrap.java +++ b/canary/src/main/java/io/littlehorse/canary/metronome/WorkerBootstrap.java @@ -1,7 +1,7 @@ package io.littlehorse.canary.metronome; -import io.littlehorse.canary.app.Bootstrap; -import io.littlehorse.canary.app.InitializationException; +import io.littlehorse.canary.Bootstrap; +import io.littlehorse.canary.CanaryException; import io.littlehorse.canary.config.CanaryConfig; import io.littlehorse.canary.kafka.MetricsEmitter; import io.littlehorse.sdk.common.config.LHConfig; @@ -25,7 +25,7 @@ private void initializeWorkflow(LHConfig lhConfig) { try { workflow.registerWfSpec(lhConfig.getBlockingStub()); } catch (IOException e) { - throw new InitializationException(e); + throw new CanaryException(e); } } @@ -36,7 +36,7 @@ private void initializeTaskWorker(LHConfig lhConfig, CanaryConfig config) { worker.registerTaskDef(); worker.start(); } catch (IOException e) { - throw new InitializationException(e); + throw new CanaryException(e); } }