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:
committed by
Artem Bilan
parent
16be9fc47d
commit
67d6cd0c89
@@ -489,23 +489,17 @@ public class StompIntegrationTests extends LogAdjustingTestSupport {
|
||||
|
||||
//TODO SimpleBrokerMessageHandler doesn't support RECEIPT frame, hence we emulate it this way
|
||||
@Bean
|
||||
@SuppressWarnings("unchecked")
|
||||
public ApplicationListener<SessionSubscribeEvent> webSocketEventListener(
|
||||
final AbstractSubscribableChannel clientOutboundChannel) {
|
||||
return new ApplicationListener<SessionSubscribeEvent>() {
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(SessionSubscribeEvent event) {
|
||||
Message<byte[]> message = event.getMessage();
|
||||
StompHeaderAccessor stompHeaderAccessor = StompHeaderAccessor.wrap(message);
|
||||
if (stompHeaderAccessor.getReceipt() != null) {
|
||||
stompHeaderAccessor.setHeader("stompCommand", StompCommand.RECEIPT);
|
||||
stompHeaderAccessor.setReceiptId(stompHeaderAccessor.getReceipt());
|
||||
clientOutboundChannel.send(
|
||||
MessageBuilder.createMessage(new byte[0], stompHeaderAccessor.getMessageHeaders()));
|
||||
}
|
||||
return event -> {
|
||||
Message<byte[]> message = event.getMessage();
|
||||
StompHeaderAccessor stompHeaderAccessor = StompHeaderAccessor.wrap(message);
|
||||
if (stompHeaderAccessor.getReceipt() != null) {
|
||||
stompHeaderAccessor.setHeader("stompCommand", StompCommand.RECEIPT);
|
||||
stompHeaderAccessor.setReceiptId(stompHeaderAccessor.getReceipt());
|
||||
clientOutboundChannel.send(
|
||||
MessageBuilder.createMessage(new byte[0], stompHeaderAccessor.getMessageHeaders()));
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -318,6 +318,10 @@ public class WebSocketServerTests {
|
||||
|
||||
private ApplicationEventPublisher applicationEventPublisher;
|
||||
|
||||
TestWebSocketHandlerDecoratorFactory() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebSocketHandler decorate(WebSocketHandler handler) {
|
||||
return new TestWebSocketHandler(handler);
|
||||
|
||||
Reference in New Issue
Block a user