add license
diff --git a/adapter/runtimer/src/main/java/org/apache/rocketmq/eventbridge/adapter/runtimer/boot/hook/AbstractStartAndShutdown.java b/adapter/runtimer/src/main/java/org/apache/rocketmq/eventbridge/adapter/runtimer/boot/hook/AbstractStartAndShutdown.java
new file mode 100644
index 0000000..051fe5a
--- /dev/null
+++ b/adapter/runtimer/src/main/java/org/apache/rocketmq/eventbridge/adapter/runtimer/boot/hook/AbstractStartAndShutdown.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.eventbridge.adapter.runtimer.boot.hook;
+
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+public abstract class AbstractStartAndShutdown implements StartAndShutdown {
+
+ protected List<StartAndShutdown> startAndShutdownList = new CopyOnWriteArrayList<>();
+
+ protected void appendStartAndShutdown(StartAndShutdown startAndShutdown) {
+ this.startAndShutdownList.add(startAndShutdown);
+ }
+
+ @Override
+ public void start() throws Exception {
+ for (StartAndShutdown startAndShutdown : startAndShutdownList) {
+ startAndShutdown.start();
+ }
+ }
+
+ @Override
+ public void shutdown() throws Exception {
+ int index = startAndShutdownList.size() - 1;
+ for (; index >= 0; index--) {
+ startAndShutdownList.get(index).shutdown();
+ }
+ }
+
+ public void appendStart(Start start) {
+ this.appendStartAndShutdown(new StartAndShutdown() {
+ @Override
+ public void shutdown() throws Exception {
+
+ }
+
+ @Override
+ public void start() throws Exception {
+ start.start();
+ }
+ });
+ }
+
+ public void appendShutdown(Shutdown shutdown) {
+ this.appendStartAndShutdown(new StartAndShutdown() {
+ @Override
+ public void shutdown() throws Exception {
+ shutdown.shutdown();
+ }
+
+ @Override
+ public void start() throws Exception {
+
+ }
+ });
+ }
+}
\ No newline at end of file
diff --git a/adapter/runtimer/src/main/java/org/apache/rocketmq/eventbridge/adapter/runtimer/boot/hook/Shutdown.java b/adapter/runtimer/src/main/java/org/apache/rocketmq/eventbridge/adapter/runtimer/boot/hook/Shutdown.java
new file mode 100644
index 0000000..f3ac5f3
--- /dev/null
+++ b/adapter/runtimer/src/main/java/org/apache/rocketmq/eventbridge/adapter/runtimer/boot/hook/Shutdown.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.eventbridge.adapter.runtimer.boot.hook;
+
+public interface Shutdown {
+ void shutdown() throws Exception;
+}
diff --git a/adapter/runtimer/src/main/java/org/apache/rocketmq/eventbridge/adapter/runtimer/boot/hook/Start.java b/adapter/runtimer/src/main/java/org/apache/rocketmq/eventbridge/adapter/runtimer/boot/hook/Start.java
new file mode 100644
index 0000000..b44d86a
--- /dev/null
+++ b/adapter/runtimer/src/main/java/org/apache/rocketmq/eventbridge/adapter/runtimer/boot/hook/Start.java
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.eventbridge.adapter.runtimer.boot.hook;
+
+public interface Start {
+ void start() throws Exception;
+}
diff --git a/adapter/runtimer/src/main/java/org/apache/rocketmq/eventbridge/adapter/runtimer/boot/hook/StartAndShutdown.java b/adapter/runtimer/src/main/java/org/apache/rocketmq/eventbridge/adapter/runtimer/boot/hook/StartAndShutdown.java
new file mode 100644
index 0000000..242c1b0
--- /dev/null
+++ b/adapter/runtimer/src/main/java/org/apache/rocketmq/eventbridge/adapter/runtimer/boot/hook/StartAndShutdown.java
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.eventbridge.adapter.runtimer.boot.hook;
+
+public interface StartAndShutdown extends Start,Shutdown {
+}
diff --git a/adapter/runtimer/src/main/java/org/apache/rocketmq/eventbridge/adapter/runtimer/utils/ShutdownUtils.java b/adapter/runtimer/src/main/java/org/apache/rocketmq/eventbridge/adapter/runtimer/utils/ShutdownUtils.java
new file mode 100644
index 0000000..980c242
--- /dev/null
+++ b/adapter/runtimer/src/main/java/org/apache/rocketmq/eventbridge/adapter/runtimer/utils/ShutdownUtils.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.eventbridge.adapter.runtimer.utils;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.TimeUnit;
+
+public class ShutdownUtils {
+
+ private static final Logger logger = LoggerFactory.getLogger(ShutdownUtils.class);
+
+ public static void shutdownThreadPool(ExecutorService executor) {
+ if (executor != null) {
+ executor.shutdown();
+ try {
+ executor.awaitTermination(60, TimeUnit.SECONDS);
+ } catch (Exception e) {
+ logger.error("Shutdown threadPool failed", e);
+ }
+ if (!executor.isTerminated()) {
+ executor.shutdownNow();
+ }
+ }
+ }
+
+ /**
+ * set final value
+ * @param completableFutures
+ */
+ public static void completedFuture(List<CompletableFuture<Void>> completableFutures){
+ for (CompletableFuture<Void> future: completableFutures) {
+ future.cancel(true);
+ } }
+}