This is an automated email from the ASF dual-hosted git repository. liyuheng pushed a commit to branch lyh/fix-procedure in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit fd77ff55932ad211f74e295929b9d9cbb7682a58 Author: liyuheng <[email protected]> AuthorDate: Thu May 22 13:30:20 2025 +0800 remove ProcedureAbortedException.java --- .../iotdb/confignode/procedure/Procedure.java | 14 +++++----- .../exception/ProcedureAbortedException.java | 30 ---------------------- 2 files changed, 6 insertions(+), 38 deletions(-) diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/Procedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/Procedure.java index d4f97c1c31b..97fd6d7e5bf 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/Procedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/Procedure.java @@ -20,10 +20,8 @@ package org.apache.iotdb.confignode.procedure; import org.apache.iotdb.confignode.procedure.env.ConfigNodeProcedureEnv; -import org.apache.iotdb.confignode.procedure.exception.ProcedureAbortedException; import org.apache.iotdb.confignode.procedure.exception.ProcedureException; import org.apache.iotdb.confignode.procedure.exception.ProcedureSuspendedException; -import org.apache.iotdb.confignode.procedure.exception.ProcedureTimeoutException; import org.apache.iotdb.confignode.procedure.exception.ProcedureYieldException; import org.apache.iotdb.confignode.procedure.state.ProcedureLockState; import org.apache.iotdb.confignode.procedure.state.ProcedureState; @@ -130,11 +128,14 @@ public abstract class Procedure<Env> implements Comparable<Procedure<Env>> { // exceptions if (hasException()) { + // symbol of exception stream.write((byte) 1); + // exception's name String exceptionClassName = exception.getClass().getName(); byte[] exceptionClassNameBytes = exceptionClassName.getBytes(StandardCharsets.UTF_8); stream.writeInt(exceptionClassNameBytes.length); stream.write(exceptionClassNameBytes); + // exception's message String message = this.exception.getMessage(); if (message != null) { byte[] messageBytes = message.getBytes(StandardCharsets.UTF_8); @@ -144,6 +145,7 @@ public abstract class Procedure<Env> implements Comparable<Procedure<Env>> { stream.writeInt(-1); } } else { + // symbol of no exception stream.write((byte) 0); } @@ -181,7 +183,7 @@ public abstract class Procedure<Env> implements Comparable<Procedure<Env>> { } this.setStackIndexes(indexList); } - // exceptions + // exception if (byteBuffer.get() == 1) { Class<?> exceptionClass = deserializeTypeInfo(byteBuffer); int messageBytesLength = byteBuffer.getInt(); @@ -676,10 +678,6 @@ public abstract class Procedure<Env> implements Comparable<Procedure<Env>> { } } - protected void setAbortFailure(final String source, final String msg) { - setFailure(source, new ProcedureAbortedException(msg)); - } - /** * Called by the ProcedureExecutor when the timeout set by setTimeout() is expired. * @@ -698,7 +696,7 @@ public abstract class Procedure<Env> implements Comparable<Procedure<Env>> { long timeDiff = System.currentTimeMillis() - lastUpdate; setFailure( "ProcedureExecutor", - new ProcedureTimeoutException("Operation timed out after " + timeDiff + " ms.")); + new ProcedureException("Operation timed out after " + timeDiff + " ms.")); return true; } return false; diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/exception/ProcedureAbortedException.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/exception/ProcedureAbortedException.java deleted file mode 100644 index 31d10e26347..00000000000 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/exception/ProcedureAbortedException.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.iotdb.confignode.procedure.exception; - -public class ProcedureAbortedException extends ProcedureException { - public ProcedureAbortedException() { - super(); - } - - public ProcedureAbortedException(String msg) { - super(msg); - } -}
