GH-2714: Fix PollSkipAdvice
Fixes https://github.com/spring-projects/spring-integration/issues/2714 Return null instead of false when poll skipped.
This commit is contained in:
committed by
Artem Bilan
parent
fff968e5ad
commit
bac3565dfd
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014 the original author or authors.
|
* Copyright 2014-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -54,7 +54,7 @@ public class PollSkipAdvice implements MethodInterceptor {
|
|||||||
+ this.pollSkipStrategy.getClass().getName()
|
+ this.pollSkipStrategy.getClass().getName()
|
||||||
+ ".skipPoll() returned true");
|
+ ".skipPoll() returned true");
|
||||||
}
|
}
|
||||||
return Boolean.FALSE;
|
return null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return invocation.proceed();
|
return invocation.proceed();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014-2018 the original author or authors.
|
* Copyright 2014-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -34,6 +34,7 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
@@ -143,6 +144,10 @@ public class PollerAdviceTests {
|
|||||||
CountDownLatch latch = new CountDownLatch(1);
|
CountDownLatch latch = new CountDownLatch(1);
|
||||||
adapter.setSource(new LocalSource(latch));
|
adapter.setSource(new LocalSource(latch));
|
||||||
adapter.setTrigger(new OnlyOnceTrigger());
|
adapter.setTrigger(new OnlyOnceTrigger());
|
||||||
|
AtomicBoolean ehCalled = new AtomicBoolean();
|
||||||
|
adapter.setErrorHandler(t -> {
|
||||||
|
ehCalled.set(true);
|
||||||
|
});
|
||||||
configure(adapter);
|
configure(adapter);
|
||||||
List<Advice> adviceChain = new ArrayList<>();
|
List<Advice> adviceChain = new ArrayList<>();
|
||||||
SimplePollSkipStrategy skipper = new SimplePollSkipStrategy();
|
SimplePollSkipStrategy skipper = new SimplePollSkipStrategy();
|
||||||
@@ -153,6 +158,7 @@ public class PollerAdviceTests {
|
|||||||
adapter.afterPropertiesSet();
|
adapter.afterPropertiesSet();
|
||||||
adapter.start();
|
adapter.start();
|
||||||
assertFalse(latch.await(10, TimeUnit.MILLISECONDS));
|
assertFalse(latch.await(10, TimeUnit.MILLISECONDS));
|
||||||
|
assertFalse(ehCalled.get());
|
||||||
adapter.stop();
|
adapter.stop();
|
||||||
skipper.reset();
|
skipper.reset();
|
||||||
latch = new CountDownLatch(1);
|
latch = new CountDownLatch(1);
|
||||||
|
|||||||
Reference in New Issue
Block a user