Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove WrapException #2359

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<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());
}
Expand Down

This file was deleted.