This is an automated email from the ASF dual-hosted git repository.

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere-elasticjob.git


The following commit(s) were added to refs/heads/master by this push:
     new c300d53b6 Remove WrapException (#2359)
c300d53b6 is described below

commit c300d53b6398aeb38d350356ba35640a28bc595d
Author: Liang Zhang <[email protected]>
AuthorDate: Tue Oct 31 21:49:50 2023 +0800

    Remove WrapException (#2359)
---
 .../storage/repository/RDBJobEventRepository.java  | 12 +++++-----
 .../kernel/tracing/exception/WrapException.java    | 28 ----------------------
 2 files changed, 6 insertions(+), 34 deletions(-)

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 01124317d..0248e633b 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 lombok.extern.slf4j.Slf4j;
 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 @@ public final class RDBJobEventRepository {
     }
     
     /**
-     * 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<RDBJobEventRepository> supplier) throws SQLException {
+    private static RDBJobEventRepository getInstance(final 
Supplier<RDBJobEventRepository> 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 a0aa125f7..000000000
--- 
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);
-    }
-}

Reply via email to