|
18 | 18 |
|
19 | 19 | import io.microsphere.lang.function.ThrowableConsumer;
|
20 | 20 | import io.microsphere.lang.function.ThrowableFunction;
|
21 |
| -import io.microsphere.logging.Logger; |
22 | 21 | import org.apache.ibatis.cache.CacheKey;
|
23 | 22 | import org.apache.ibatis.cursor.Cursor;
|
24 | 23 | import org.apache.ibatis.executor.Executor;
|
|
38 | 37 | import java.util.Properties;
|
39 | 38 | import java.util.function.Function;
|
40 | 39 |
|
41 |
| -import static io.microsphere.logging.LoggerFactory.getLogger; |
42 | 40 | import static io.microsphere.util.ArrayUtils.length;
|
43 | 41 | import static io.microsphere.util.Assert.assertNotEmpty;
|
44 | 42 | import static io.microsphere.util.Assert.assertNotNull;
|
|
53 | 51 | */
|
54 | 52 | public class ExecutorFilterChain {
|
55 | 53 |
|
56 |
| - private static final Logger logger = getLogger(ExecutorFilterChain.class); |
57 |
| - |
58 | 54 | private final Executor executor;
|
59 | 55 |
|
60 | 56 | @Nullable
|
@@ -159,26 +155,16 @@ protected <R> R applySQL(ThrowableFunction<ExecutorFilter, R> filterFunction,
|
159 | 155 | protected <E extends Throwable, R> R process(ThrowableFunction<ExecutorFilter, R> filterFunction,
|
160 | 156 | ThrowableFunction<Executor, R> executorFunction,
|
161 | 157 | 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; |
176 | 159 | 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 | + } |
178 | 165 | } catch (Throwable failure) {
|
179 | 166 | throw failureHandler.apply(failure);
|
180 | 167 | }
|
181 |
| - |
182 | 168 | return result;
|
183 | 169 | }
|
184 | 170 |
|
|
0 commit comments