diff --git a/ecosystem/tracing/rdb/src/main/java/org/apache/shardingsphere/elasticjob/tracing/rdb/storage/repository/RDBJobEventRepository.java b/ecosystem/tracing/rdb/src/main/java/org/apache/shardingsphere/elasticjob/tracing/rdb/storage/repository/RDBJobEventRepository.java index 01124317db..0248e633b5 100644 --- a/ecosystem/tracing/rdb/src/main/java/org/apache/shardingsphere/elasticjob/tracing/rdb/storage/repository/RDBJobEventRepository.java +++ b/ecosystem/tracing/rdb/src/main/java/org/apache/shardingsphere/elasticjob/tracing/rdb/storage/repository/RDBJobEventRepository.java @@ -22,7 +22,7 @@ import org.apache.shardingsphere.elasticjob.kernel.tracing.event.JobExecutionEvent; import org.apache.shardingsphere.elasticjob.kernel.tracing.event.JobStatusTraceEvent; import org.apache.shardingsphere.elasticjob.kernel.tracing.event.JobStatusTraceEvent.State; -import org.apache.shardingsphere.elasticjob.kernel.tracing.exception.WrapException; +import org.apache.shardingsphere.elasticjob.kernel.tracing.exception.TracingStorageUnavailableException; import org.apache.shardingsphere.elasticjob.tracing.rdb.storage.sql.RDBStorageSQLMapper; import org.apache.shardingsphere.elasticjob.tracing.rdb.storage.sql.SQLPropertiesFactory; import org.apache.shardingsphere.elasticjob.tracing.rdb.storage.type.TracingStorageDatabaseType; @@ -69,26 +69,26 @@ private RDBJobEventRepository(final DataSource dataSource) throws SQLException { } /** - * The same dataSource always return the same RDBJobEventStorage instance. + * The same data source always return the same RDB job event repository instance. * * @param dataSource dataSource * @return RDBJobEventStorage instance * @throws SQLException SQLException */ public static RDBJobEventRepository getInstance(final DataSource dataSource) throws SQLException { - return wrapException(() -> STORAGE_MAP.computeIfAbsent(dataSource, ds -> { + return getInstance(() -> STORAGE_MAP.computeIfAbsent(dataSource, ds -> { try { return new RDBJobEventRepository(ds); } catch (final SQLException ex) { - throw new WrapException(ex); + throw new TracingStorageUnavailableException(ex); } })); } - private static RDBJobEventRepository wrapException(final Supplier supplier) throws SQLException { + private static RDBJobEventRepository getInstance(final Supplier supplier) throws SQLException { try { return supplier.get(); - } catch (final WrapException ex) { + } catch (final TracingStorageUnavailableException ex) { if (ex.getCause() instanceof SQLException) { throw new SQLException(ex.getCause()); } diff --git a/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/tracing/exception/WrapException.java b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/tracing/exception/WrapException.java deleted file mode 100644 index a0aa125f70..0000000000 --- a/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/tracing/exception/WrapException.java +++ /dev/null @@ -1,28 +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.shardingsphere.elasticjob.kernel.tracing.exception; - -/** - * Use to wrap Exception. - */ -public class WrapException extends RuntimeException { - - public WrapException(final Throwable cause) { - super(cause); - } -}