Reduce access on headers for STOMP messaging

Issue: SPR-16165
This commit is contained in:
Juergen Hoeller
2017-11-14 12:30:24 +01:00
parent d5f34ed641
commit f861f182fa
5 changed files with 67 additions and 45 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -285,11 +285,12 @@ public class StompSubProtocolHandler implements SubProtocolHandler, ApplicationE
logger.trace("From client: " + headerAccessor.getShortLogMessage(message.getPayload()));
}
boolean isConnect = StompCommand.CONNECT.equals(headerAccessor.getCommand());
StompCommand command = headerAccessor.getCommand();
boolean isConnect = StompCommand.CONNECT.equals(command);
if (isConnect) {
this.stats.incrementConnectCount();
}
else if (StompCommand.DISCONNECT.equals(headerAccessor.getCommand())) {
else if (StompCommand.DISCONNECT.equals(command)) {
this.stats.incrementDisconnectCount();
}
@@ -308,10 +309,10 @@ public class StompSubProtocolHandler implements SubProtocolHandler, ApplicationE
if (isConnect) {
publishEvent(new SessionConnectEvent(this, message, getUser(session)));
}
else if (StompCommand.SUBSCRIBE.equals(headerAccessor.getCommand())) {
else if (StompCommand.SUBSCRIBE.equals(command)) {
publishEvent(new SessionSubscribeEvent(this, message, getUser(session)));
}
else if (StompCommand.UNSUBSCRIBE.equals(headerAccessor.getCommand())) {
else if (StompCommand.UNSUBSCRIBE.equals(command)) {
publishEvent(new SessionUnsubscribeEvent(this, message, getUser(session)));
}
}