|
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.
|
|
60 | 60 | * sub-protocol handler to send messages from the application back to the client.
|
61 | 61 | *
|
62 | 62 | * @author Rossen Stoyanchev
|
| 63 | + * @author Juergen Hoeller |
63 | 64 | * @author Andy Wilkinson
|
64 | 65 | * @author Artem Bilan
|
65 | 66 | * @since 4.0
|
@@ -152,8 +153,8 @@ public void addProtocolHandler(SubProtocolHandler handler) {
|
152 | 153 | for (String protocol : protocols) {
|
153 | 154 | SubProtocolHandler replaced = this.protocolHandlerLookup.put(protocol, handler);
|
154 | 155 | if (replaced != null && replaced != handler) {
|
155 |
| - throw new IllegalStateException("Can't map " + handler + |
156 |
| - " to protocol '" + protocol + "'. Already mapped to " + replaced + "."); |
| 156 | + throw new IllegalStateException("Cannot map " + handler + |
| 157 | + " to protocol '" + protocol + "': already mapped to " + replaced + "."); |
157 | 158 | }
|
158 | 159 | }
|
159 | 160 | this.protocolHandlers.add(handler);
|
@@ -260,8 +261,8 @@ public final void stop() {
|
260 | 261 | holder.getSession().close(CloseStatus.GOING_AWAY);
|
261 | 262 | }
|
262 | 263 | catch (Throwable ex) {
|
263 |
| - if (logger.isErrorEnabled()) { |
264 |
| - logger.error("Failed to close '" + holder.getSession() + "': " + ex); |
| 264 | + if (logger.isWarnEnabled()) { |
| 265 | + logger.warn("Failed to close '" + holder.getSession() + "': " + ex); |
265 | 266 | }
|
266 | 267 | }
|
267 | 268 | }
|
@@ -321,7 +322,7 @@ public void handleMessage(Message<?> message) throws MessagingException {
|
321 | 322 | String sessionId = resolveSessionId(message);
|
322 | 323 | if (sessionId == null) {
|
323 | 324 | if (logger.isErrorEnabled()) {
|
324 |
| - logger.error("Couldn't find session id in " + message); |
| 325 | + logger.error("Could not find session id in " + message); |
325 | 326 | }
|
326 | 327 | return;
|
327 | 328 | }
|
@@ -400,8 +401,8 @@ protected final SubProtocolHandler findProtocolHandler(WebSocketSession session)
|
400 | 401 | }
|
401 | 402 | catch (Exception ex) {
|
402 | 403 | // Shouldn't happen
|
403 |
| - logger.error("Failed to obtain session.getAcceptedProtocol(). " + |
404 |
| - "Will use the default protocol handler (if configured).", ex); |
| 404 | + logger.error("Failed to obtain session.getAcceptedProtocol(): " + |
| 405 | + "will use the default protocol handler (if configured).", ex); |
405 | 406 | }
|
406 | 407 |
|
407 | 408 | SubProtocolHandler handler;
|
@@ -469,17 +470,17 @@ private void checkSessions() {
|
469 | 470 | continue;
|
470 | 471 | }
|
471 | 472 | WebSocketSession session = holder.getSession();
|
472 |
| - if (logger.isErrorEnabled()) { |
473 |
| - logger.error("No messages received after " + timeSinceCreated + " ms. " + |
| 473 | + if (logger.isInfoEnabled()) { |
| 474 | + logger.info("No messages received after " + timeSinceCreated + " ms. " + |
474 | 475 | "Closing " + holder.getSession() + ".");
|
475 | 476 | }
|
476 | 477 | try {
|
477 | 478 | this.stats.incrementNoMessagesReceivedCount();
|
478 | 479 | session.close(CloseStatus.SESSION_NOT_RELIABLE);
|
479 | 480 | }
|
480 | 481 | catch (Throwable ex) {
|
481 |
| - if (logger.isErrorEnabled()) { |
482 |
| - logger.error("Failure while closing " + session, ex); |
| 482 | + if (logger.isWarnEnabled()) { |
| 483 | + logger.warn("Failed to close unreliable " + session, ex); |
483 | 484 | }
|
484 | 485 | }
|
485 | 486 | }
|
|
0 commit comments