Polishing
This commit is contained in:
parent
bdb606b8b1
commit
21329df7e1
|
@ -58,7 +58,10 @@ import org.springframework.util.StringUtils;
|
|||
*/
|
||||
public class ReflectivePropertyAccessor implements PropertyAccessor {
|
||||
|
||||
private static final Set<Class<?>> ANY_TYPES = Collections.emptySet();
|
||||
|
||||
private static final Set<Class<?>> BOOLEAN_TYPES;
|
||||
|
||||
static {
|
||||
Set<Class<?>> booleanTypes = new HashSet<Class<?>>();
|
||||
booleanTypes.add(Boolean.class);
|
||||
|
@ -66,8 +69,6 @@ public class ReflectivePropertyAccessor implements PropertyAccessor {
|
|||
BOOLEAN_TYPES = Collections.unmodifiableSet(booleanTypes);
|
||||
}
|
||||
|
||||
private static final Set<Class<?>> ANY_TYPES = Collections.emptySet();
|
||||
|
||||
|
||||
private final Map<CacheKey, InvokerPair> readerCache = new ConcurrentHashMap<CacheKey, InvokerPair>(64);
|
||||
|
||||
|
@ -122,7 +123,7 @@ public class ReflectivePropertyAccessor implements PropertyAccessor {
|
|||
}
|
||||
|
||||
public Member getLastReadInvokerPair() {
|
||||
return lastReadInvokerPair.member;
|
||||
return this.lastReadInvokerPair.member;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -143,12 +143,14 @@ public class SubProtocolWebSocketHandler
|
|||
public void addProtocolHandler(SubProtocolHandler handler) {
|
||||
List<String> protocols = handler.getSupportedProtocols();
|
||||
if (CollectionUtils.isEmpty(protocols)) {
|
||||
logger.error("No sub-protocols for " + handler + ".");
|
||||
if (logger.isErrorEnabled()) {
|
||||
logger.error("No sub-protocols for " + handler);
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (String protocol: protocols) {
|
||||
for (String protocol : protocols) {
|
||||
SubProtocolHandler replaced = this.protocolHandlerLookup.put(protocol, handler);
|
||||
if ((replaced != null) && (replaced != handler) ) {
|
||||
if (replaced != null && replaced != handler) {
|
||||
throw new IllegalStateException("Can't map " + handler +
|
||||
" to protocol '" + protocol + "'. Already mapped to " + replaced + ".");
|
||||
}
|
||||
|
@ -316,9 +318,12 @@ public class SubProtocolWebSocketHandler
|
|||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
String sessionId = resolveSessionId(message);
|
||||
if (sessionId == null) {
|
||||
logger.error("Couldn't find sessionId in " + message);
|
||||
if (logger.isErrorEnabled()) {
|
||||
logger.error("Couldn't find session id in " + message);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
WebSocketSessionHolder holder = this.sessions.get(sessionId);
|
||||
if (holder == null) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
|
@ -327,6 +332,7 @@ public class SubProtocolWebSocketHandler
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
WebSocketSession session = holder.getSession();
|
||||
try {
|
||||
findProtocolHandler(session).handleMessageToClient(session, message);
|
||||
|
@ -344,9 +350,11 @@ public class SubProtocolWebSocketHandler
|
|||
logger.debug("Failure while closing session " + sessionId + ".", secondException);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
catch (Exception ex) {
|
||||
// Could be part of normal workflow (e.g. browser tab closed)
|
||||
logger.debug("Failed to send message to client in " + session + ": " + message, e);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Failed to send message to client in " + session + ": " + message, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue