This is an automated email from the ASF dual-hosted git repository. haonan pushed a commit to branch update_license in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 99924b9da80032da50a8a047e40c297ca6814071 Author: HTHou <[email protected]> AuthorDate: Thu Sep 11 12:10:30 2025 +0800 Update LICENSE and remove useless code --- LICENSE | 10 +++ .../apache/iotdb/cli/IoTDBSyntaxHighlighter.java | 80 ---------------------- .../java/org/apache/iotdb/metrics/type/Timer.java | 16 +++-- 3 files changed, 20 insertions(+), 86 deletions(-) diff --git a/LICENSE b/LICENSE index ca54f242f56..682529c8278 100644 --- a/LICENSE +++ b/LICENSE @@ -211,6 +211,16 @@ The following files include code modified from Apache HBase project. ./iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/StateMachineProcedure.java ./iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/TimeoutExecutorThread.java ./iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/StoppableThread.java +./iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/CompletedProcedureRecycler.java +./iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/RootProcedureStack.java +./iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/scheduler/AbstractProcedureScheduler.java +./iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/scheduler/ProcedureScheduler.java +./iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/scheduler/SimpleProcedureScheduler.java +./iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/ratis/metrics/RefCountingMap.java +./iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/rescon/quotas/DataNodeThrottleQuotaManager.java +./iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/rescon/quotas/DefaultOperationQuota.java +./iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/rescon/quotas/NoopOperationQuota.java +./iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/rescon/quotas/QuotaLimiter.java Project page: https://github.com/apache/hbase License: https://github.com/apache/hbase/blob/master/LICENSE.txt diff --git a/iotdb-client/cli/src/main/java/org/apache/iotdb/cli/IoTDBSyntaxHighlighter.java b/iotdb-client/cli/src/main/java/org/apache/iotdb/cli/IoTDBSyntaxHighlighter.java deleted file mode 100644 index a9e66f1f506..00000000000 --- a/iotdb-client/cli/src/main/java/org/apache/iotdb/cli/IoTDBSyntaxHighlighter.java +++ /dev/null @@ -1,80 +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.cli; - -import org.apache.iotdb.cli.utils.JlineUtils; -import org.apache.iotdb.db.qp.sql.SqlLexer; - -import org.antlr.v4.runtime.CharStream; -import org.antlr.v4.runtime.CharStreams; -import org.antlr.v4.runtime.Token; -import org.jline.reader.Highlighter; -import org.jline.reader.LineReader; -import org.jline.utils.AttributedString; -import org.jline.utils.AttributedStringBuilder; -import org.jline.utils.AttributedStyle; - -import java.util.regex.Pattern; - -import static org.jline.utils.AttributedStyle.DEFAULT; -import static org.jline.utils.AttributedStyle.GREEN; - -public class IoTDBSyntaxHighlighter implements Highlighter { - - private static final AttributedStyle KEYWORD_STYLE = DEFAULT.foreground(GREEN); - - @Override - public AttributedString highlight(LineReader reader, String buffer) { - CharStream stream = CharStreams.fromString(buffer); - SqlLexer tokenSource = new SqlLexer(stream); - tokenSource.removeErrorListeners(); - AttributedStringBuilder builder = new AttributedStringBuilder(); - while (true) { - Token token = tokenSource.nextToken(); - int type = token.getType(); - if (type == Token.EOF) { - break; - } - String text = token.getText(); - - if (isKeyword(text)) { - builder.styled(KEYWORD_STYLE, text); - } else { - builder.append(text); - } - } - - return builder.toAttributedString(); - } - - @Override - public void setErrorPattern(Pattern errorPattern) { - // This method is not needed. - } - - @Override - public void setErrorIndex(int errorIndex) { - // This method is not needed. - } - - private boolean isKeyword(String token) { - return JlineUtils.SQL_KEYWORDS.contains(token.toUpperCase()); - } -} diff --git a/iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/type/Timer.java b/iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/type/Timer.java index 0f7478991f1..95f5953c9f9 100644 --- a/iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/type/Timer.java +++ b/iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/type/Timer.java @@ -22,24 +22,28 @@ package org.apache.iotdb.metrics.type; import java.util.Map; import java.util.concurrent.TimeUnit; +import static java.util.concurrent.TimeUnit.MICROSECONDS; +import static java.util.concurrent.TimeUnit.MILLISECONDS; +import static java.util.concurrent.TimeUnit.NANOSECONDS; + public interface Timer extends IMetric { /** Update time of timer. */ void update(long duration, TimeUnit unit); /** Update timer by millisecond. */ - default void updateMillis(long durationMillis) { - update(durationMillis, TimeUnit.MILLISECONDS); + default void updateMillis(long duration) { + update(duration, MILLISECONDS); } /** Update timer by microseconds. */ - default void updateMicros(long durationMicros) { - update(durationMicros, TimeUnit.MICROSECONDS); + default void updateMicros(long duration) { + update(duration, MICROSECONDS); } /** Update timer by nanoseconds. */ - default void updateNanos(long durationNanos) { - update(durationNanos, TimeUnit.NANOSECONDS); + default void updateNanos(long duration) { + update(duration, NANOSECONDS); } /** Take snapshot of timer. */
