Lambdas for Remaining Modules JPA -> ZK

Polishing - PR Comments and Closeable Warnings

Eclipse emits bogus warnings with exceptions in lambdas.
Even though the lambda might run on another thread, elipse thinks it could
cause the context to not be closed.

SPR-14854: MessageChannel is now a @FunctionalInterface

* Additional Lambda polishing and some code style fixes
This commit is contained in:
Gary Russell
2016-10-28 12:07:06 -04:00
committed by Artem Bilan
parent 16be9fc47d
commit 67d6cd0c89
83 changed files with 870 additions and 1324 deletions

View File

@@ -194,13 +194,7 @@ public class TestSubscriber<T>
public static void await(Duration timeout,
final String errorMessage,
BooleanSupplier conditionSupplier) {
await(timeout, new Supplier<String>() {
@Override
public String get() {
return errorMessage;
}
}, conditionSupplier);
await(timeout, () -> errorMessage, conditionSupplier);
}
/**

View File

@@ -18,7 +18,6 @@ package org.springframework.integration.test.util;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Properties;
import java.util.Set;
@@ -45,8 +44,6 @@ import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.ErrorHandler;
import org.springframework.util.ReflectionUtils;
import org.springframework.util.ReflectionUtils.MethodCallback;
import org.springframework.util.ReflectionUtils.MethodFilter;
import org.springframework.util.StringUtils;
/**
@@ -133,7 +130,7 @@ public abstract class TestUtils {
public static class TestApplicationContext extends GenericApplicationContext {
private TestApplicationContext() {
TestApplicationContext() {
super();
}
@@ -156,26 +153,14 @@ public abstract class TestUtils {
final AtomicReference<String> componentName = new AtomicReference<String>();
for (Class<?> intface : interfaces) {
if ("org.springframework.integration.support.context.NamedComponent".equals(intface.getName())) {
ReflectionUtils.doWithMethods(channel.getClass(), new MethodCallback() {
@Override
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
try {
componentName.set((String) method.invoke(channel, new Object[0]));
}
catch (InvocationTargetException e) {
throw new IllegalArgumentException(e);
}
ReflectionUtils.doWithMethods(channel.getClass(), method -> {
try {
componentName.set((String) method.invoke(channel, new Object[0]));
}
}, new MethodFilter() {
@Override
public boolean matches(Method method) {
return method.getName().equals("getComponentName");
catch (InvocationTargetException e) {
throw new IllegalArgumentException(e);
}
});
}, method -> method.getName().equals("getComponentName"));
break;
}
}
@@ -229,7 +214,7 @@ public abstract class TestUtils {
private final TestApplicationContext context;
private MessagePublishingErrorHandler(TestApplicationContext ctx) {
MessagePublishingErrorHandler(TestApplicationContext ctx) {
this.context = ctx;
}