Skip to content

Commit 137a037

Browse files
committed
Removed tracing from YdbValidator
1 parent 1e83223 commit 137a037

File tree

4 files changed

+4
-59
lines changed

4 files changed

+4
-59
lines changed

jdbc/src/main/java/tech/ydb/jdbc/context/YdbValidator.java

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
import java.util.List;
88
import java.util.concurrent.CompletableFuture;
99
import java.util.function.Supplier;
10-
import java.util.logging.Level;
11-
import java.util.logging.Logger;
12-
13-
import com.google.common.base.Stopwatch;
1410

1511
import tech.ydb.core.Issue;
1612
import tech.ydb.core.Result;
@@ -23,16 +19,8 @@
2319
* @author Aleksandr Gorshenin
2420
*/
2521
public class YdbValidator {
26-
@SuppressWarnings("NonConstantLogger")
27-
private final Logger logger;
28-
private final boolean isDebug;
2922
private final List<Issue> issues = new ArrayList<>();
3023

31-
public YdbValidator(Logger logger) {
32-
this.logger = logger;
33-
this.isDebug = logger.isLoggable(Level.FINE);
34-
}
35-
3624
public SQLWarning toSQLWarnings() {
3725
SQLWarning firstWarning = null;
3826
SQLWarning warning = null;
@@ -62,48 +50,6 @@ public void clearWarnings() {
6250
}
6351

6452
public void execute(String msg, Supplier<CompletableFuture<Status>> fn) throws SQLException {
65-
if (!isDebug) {
66-
runImpl(msg, fn);
67-
return;
68-
}
69-
70-
logger.finest(msg);
71-
Stopwatch sw = Stopwatch.createStarted();
72-
73-
try {
74-
runImpl(msg, fn);
75-
logger.log(Level.FINEST, "[{0}] OK ", sw.stop());
76-
} catch (SQLException ex) {
77-
logger.log(Level.FINE, "[{0}] {1} ", new Object[] {sw.stop(), ex.getMessage()});
78-
throw ex;
79-
} catch (Exception ex) {
80-
logger.log(Level.WARNING, "ERROR ", ex);
81-
throw ex;
82-
}
83-
}
84-
85-
public <R> R call(String msg, Supplier<CompletableFuture<Result<R>>> fn) throws SQLException {
86-
if (!isDebug) {
87-
return callImpl(msg, fn);
88-
}
89-
90-
logger.finest(msg);
91-
Stopwatch sw = Stopwatch.createStarted();
92-
93-
try {
94-
R value = callImpl(msg, fn);
95-
logger.log(Level.FINEST, "[{0}] OK ", sw.stop());
96-
return value;
97-
} catch (SQLException ex) {
98-
logger.log(Level.FINE, "[{0}] FAIL {1} ", new Object[] {sw.stop(), ex.getMessage()});
99-
throw ex;
100-
} catch (Exception ex) {
101-
logger.log(Level.WARNING, "ERROR ", ex);
102-
throw ex;
103-
}
104-
}
105-
106-
private void runImpl(String msg, Supplier<CompletableFuture<Status>> fn) throws SQLException {
10753
Status status = fn.get().join();
10854
addStatusIssues(status);
10955

@@ -113,7 +59,7 @@ private void runImpl(String msg, Supplier<CompletableFuture<Status>> fn) throws
11359
}
11460
}
11561

116-
private <R> R callImpl(String msg, Supplier<CompletableFuture<Result<R>>> fn) throws SQLException {
62+
public <R> R call(String msg, Supplier<CompletableFuture<Result<R>>> fn) throws SQLException {
11763
try {
11864
Result<R> result = fn.get().join();
11965
addStatusIssues(result.getStatus());
@@ -122,5 +68,4 @@ private <R> R callImpl(String msg, Supplier<CompletableFuture<Result<R>>> fn) th
12268
throw ExceptionFactory.createException("Cannot call '" + msg + "' with " + ex.getStatus(), ex);
12369
}
12470
}
125-
12671
}

jdbc/src/main/java/tech/ydb/jdbc/impl/BaseYdbStatement.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public abstract class BaseYdbStatement implements YdbStatement {
4343

4444
public BaseYdbStatement(Logger logger, YdbConnection connection, int resultSetType, boolean isPoolable) {
4545
this.connection = Objects.requireNonNull(connection);
46-
this.validator = new YdbValidator(logger);
46+
this.validator = new YdbValidator();
4747
this.resultSetType = resultSetType;
4848
this.isPoolable = isPoolable;
4949

jdbc/src/main/java/tech/ydb/jdbc/impl/YdbConnectionImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class YdbConnectionImpl implements YdbConnection {
4242
public YdbConnectionImpl(YdbContext context) throws SQLException {
4343
this.ctx = context;
4444

45-
this.validator = new YdbValidator(LOGGER);
45+
this.validator = new YdbValidator();
4646
this.executor = ctx.createExecutor();
4747
this.ctx.register();
4848
}

jdbc/src/main/java/tech/ydb/jdbc/impl/YdbDatabaseMetaDataImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public class YdbDatabaseMetaDataImpl implements YdbDatabaseMetaData {
5656
public YdbDatabaseMetaDataImpl(YdbConnection connection) {
5757
this.connection = Objects.requireNonNull(connection);
5858
this.executor = new SchemeExecutor(connection.getCtx());
59-
this.validator = new YdbValidator(LOGGER);
59+
this.validator = new YdbValidator();
6060
}
6161

6262
@Override

0 commit comments

Comments
 (0)