Skip to content

Commit c3c18ff

Browse files
authored
Merge pull request #22 from microsphere-projects/dev
Dev
2 parents 24ce380 + 1bcac2f commit c3c18ff

File tree

2 files changed

+7
-22
lines changed

2 files changed

+7
-22
lines changed

microsphere-mybatis-core/src/main/java/io/microsphere/mybatis/executor/ExecutorFilterChain.java

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import io.microsphere.lang.function.ThrowableConsumer;
2020
import io.microsphere.lang.function.ThrowableFunction;
21-
import io.microsphere.logging.Logger;
2221
import org.apache.ibatis.cache.CacheKey;
2322
import org.apache.ibatis.cursor.Cursor;
2423
import org.apache.ibatis.executor.Executor;
@@ -38,7 +37,6 @@
3837
import java.util.Properties;
3938
import java.util.function.Function;
4039

41-
import static io.microsphere.logging.LoggerFactory.getLogger;
4240
import static io.microsphere.util.ArrayUtils.length;
4341
import static io.microsphere.util.Assert.assertNotEmpty;
4442
import static io.microsphere.util.Assert.assertNotNull;
@@ -53,8 +51,6 @@
5351
*/
5452
public class ExecutorFilterChain {
5553

56-
private static final Logger logger = getLogger(ExecutorFilterChain.class);
57-
5854
private final Executor executor;
5955

6056
@Nullable
@@ -159,26 +155,16 @@ protected <R> R applySQL(ThrowableFunction<ExecutorFilter, R> filterFunction,
159155
protected <E extends Throwable, R> R process(ThrowableFunction<ExecutorFilter, R> filterFunction,
160156
ThrowableFunction<Executor, R> executorFunction,
161157
Function<Throwable, E> failureHandler) throws E {
162-
163-
if (position < size) {
164-
ExecutorFilter filter = filters[position++];
165-
try {
166-
return filterFunction.apply(filter);
167-
} catch (Throwable e) {
168-
if (logger.isWarnEnabled()) {
169-
logger.warn("Failed to execute ExecutorFilter[ index : {} , instance : {}]", position, filter, e);
170-
}
171-
}
172-
}
173-
174-
R result = null;
175-
158+
final R result;
176159
try {
177-
result = executorFunction.apply(this.executor);
160+
if (position < size) {
161+
result = filterFunction.apply(filters[position++]);
162+
} else {
163+
result = executorFunction.apply(this.executor);
164+
}
178165
} catch (Throwable failure) {
179166
throw failureHandler.apply(failure);
180167
}
181-
182168
return result;
183169
}
184170

microsphere-mybatis-core/src/test/java/io/microsphere/mybatis/plugin/InterceptingExecutorInterceptorTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
*/
1717
package io.microsphere.mybatis.plugin;
1818

19-
import io.microsphere.mybatis.executor.ThrowingErrorExecutorFilter;
2019
import io.microsphere.mybatis.executor.LogggingExecutorInterceptor;
2120
import io.microsphere.mybatis.executor.LoggingExecutorFilter;
2221
import io.microsphere.mybatis.executor.TestExecutorFilter;
@@ -45,7 +44,7 @@ protected void customize(Configuration configuration) {
4544

4645
private InterceptingExecutorInterceptor createInterceptingExecutorInterceptor() {
4746
InterceptingExecutorInterceptor interceptor = new InterceptingExecutorInterceptor(
48-
of(new LoggingExecutorFilter(), new TestExecutorFilter(), new ThrowingErrorExecutorFilter()),
47+
of(new LoggingExecutorFilter(), new TestExecutorFilter()),
4948
new LogggingExecutorInterceptor(), new TestInterceptorContextExecutorInterceptor());
5049
Properties properties = new Properties();
5150
properties.setProperty(TEST_PROPERTY_KEY, this.getClass().getName());

0 commit comments

Comments
 (0)