|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2017 the original author or authors. |
| 2 | + * Copyright 2002-2018 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
59 | 59 | * sub-protocol handler to send messages from the application back to the client.
|
60 | 60 | *
|
61 | 61 | * @author Rossen Stoyanchev
|
| 62 | + * @author Juergen Hoeller |
62 | 63 | * @author Andy Wilkinson
|
63 | 64 | * @author Artem Bilan
|
64 | 65 | * @since 4.0
|
@@ -150,8 +151,8 @@ public void addProtocolHandler(SubProtocolHandler handler) {
|
150 | 151 | for (String protocol : protocols) {
|
151 | 152 | SubProtocolHandler replaced = this.protocolHandlerLookup.put(protocol, handler);
|
152 | 153 | if (replaced != null && replaced != handler) {
|
153 |
| - throw new IllegalStateException("Can't map " + handler + |
154 |
| - " to protocol '" + protocol + "'. Already mapped to " + replaced + "."); |
| 154 | + throw new IllegalStateException("Cannot map " + handler + |
| 155 | + " to protocol '" + protocol + "': already mapped to " + replaced + "."); |
155 | 156 | }
|
156 | 157 | }
|
157 | 158 | this.protocolHandlers.add(handler);
|
@@ -257,8 +258,8 @@ public final void stop() {
|
257 | 258 | holder.getSession().close(CloseStatus.GOING_AWAY);
|
258 | 259 | }
|
259 | 260 | catch (Throwable ex) {
|
260 |
| - if (logger.isErrorEnabled()) { |
261 |
| - logger.error("Failed to close '" + holder.getSession() + "': " + ex); |
| 261 | + if (logger.isWarnEnabled()) { |
| 262 | + logger.warn("Failed to close '" + holder.getSession() + "': " + ex); |
262 | 263 | }
|
263 | 264 | }
|
264 | 265 | }
|
@@ -318,7 +319,7 @@ public void handleMessage(Message<?> message) throws MessagingException {
|
318 | 319 | String sessionId = resolveSessionId(message);
|
319 | 320 | if (sessionId == null) {
|
320 | 321 | if (logger.isErrorEnabled()) {
|
321 |
| - logger.error("Couldn't find session id in " + message); |
| 322 | + logger.error("Could not find session id in " + message); |
322 | 323 | }
|
323 | 324 | return;
|
324 | 325 | }
|
@@ -397,8 +398,8 @@ protected final SubProtocolHandler findProtocolHandler(WebSocketSession session)
|
397 | 398 | }
|
398 | 399 | catch (Exception ex) {
|
399 | 400 | // Shouldn't happen
|
400 |
| - logger.error("Failed to obtain session.getAcceptedProtocol(). " + |
401 |
| - "Will use the default protocol handler (if configured).", ex); |
| 401 | + logger.error("Failed to obtain session.getAcceptedProtocol(): " + |
| 402 | + "will use the default protocol handler (if configured).", ex); |
402 | 403 | }
|
403 | 404 |
|
404 | 405 | SubProtocolHandler handler;
|
@@ -465,17 +466,17 @@ private void checkSessions() {
|
465 | 466 | continue;
|
466 | 467 | }
|
467 | 468 | WebSocketSession session = holder.getSession();
|
468 |
| - if (logger.isErrorEnabled()) { |
469 |
| - logger.error("No messages received after " + timeSinceCreated + " ms. " + |
| 469 | + if (logger.isInfoEnabled()) { |
| 470 | + logger.info("No messages received after " + timeSinceCreated + " ms. " + |
470 | 471 | "Closing " + holder.getSession() + ".");
|
471 | 472 | }
|
472 | 473 | try {
|
473 | 474 | this.stats.incrementNoMessagesReceivedCount();
|
474 | 475 | session.close(CloseStatus.SESSION_NOT_RELIABLE);
|
475 | 476 | }
|
476 | 477 | catch (Throwable ex) {
|
477 |
| - if (logger.isErrorEnabled()) { |
478 |
| - logger.error("Failure while closing " + session, ex); |
| 478 | + if (logger.isWarnEnabled()) { |
| 479 | + logger.warn("Failed to close unreliable " + session, ex); |
479 | 480 | }
|
480 | 481 | }
|
481 | 482 | }
|
|
0 commit comments