Commit Graph

1101 Commits

Author SHA1 Message Date
Brian Clozel 3b53165574 Expose WebSocketMessageBrokerStats contracts
Prior to this commit, the `WebSocketMessageBrokerStats` would be in
charge of periodically logging WebSocket stats. This class would also
publicly expose each stats type with dedicated methods, as `String`.
This would not allow observation libraries to easily extract information
and turn them into metrics.

This commit introduces new methods exposing the `Stats` types directly
and deprecates the former `String` variants. This will allow
observability libraries like Micrometer to expose this as metrics:

```
MeterRegistry meterRegistry = ...;

Gauge.builder("spring.stomp.frames", stats.getStompSubProtocolStats(),
      StompSubProtocolHandler.Stats::getTotalConnect)
  .tag("type", "CONNECT")
  .description("number of CONNECT frames processed")
  .register(meterRegistry);
```

Closes gh-31604
2024-05-27 16:06:32 +02:00
rstoyanchev 8c9b6e2205 Use default phase 0 for WebSocket messaging
Closes gh-27519
2024-05-21 15:49:38 +01:00
Juergen Hoeller 645556a28c Merge branch '6.1.x' 2024-05-07 15:53:00 +02:00
Juergen Hoeller 4f02be263f Polishing 2024-05-07 15:52:13 +02:00
Juergen Hoeller 3991cae875 Merge branch '6.1.x' 2024-04-23 16:07:46 +02:00
Juergen Hoeller d151931f86 Skip close lock if acquired by other thread already
Closes gh-32445
2024-04-23 16:06:48 +02:00
Sébastien Deleuze 2fea3d7921 Merge branch '6.1.x' 2024-03-26 15:41:46 +01:00
Sébastien Deleuze 290a41d398 Refine null-safety in more modules
This commit refines the null-safety in all remaining modules
except spring-test.

See gh-32475
2024-03-26 15:39:18 +01:00
Stéphane Nicoll c1ed504ac1 Avoid classpath scanning in test
This commit updates SpringConfiguratorTests to not rely on classpath
scanning as it could have side effect. In this particular case, the
configuration class that sources the scan is detected again, leading
to bean overriding.

Irrespective of that, adding more code in that package may have side
effect as they could be scanned as well.

Closes gh-32535
2024-03-26 10:41:00 +01:00
Sébastien Deleuze 2b1eb488fc Merge branch '6.1.x' 2024-03-25 11:04:49 +01:00
Sébastien Deleuze a63ebe7e9d Refine null-safety in spring-web and spring-websocket
See gh-32475
2024-03-25 11:02:44 +01:00
Sam Brannen 7edd4e8e22 Clean up warnings in Gradle build 2024-03-23 09:28:49 +01:00
rstoyanchev f9883d8bd6 Polishing contribution
Closes gh-31970
2024-03-12 10:43:31 +00:00
rstoyanchev 73ee86c666 Split messages only if configured to do so
See gh-31970
2024-03-12 10:43:31 +00:00
injae-kim 76d00d78db Support splitting STOMP messages in WebSocketStompClient
See gh-31970
2024-03-12 10:43:31 +00:00
Sam Brannen 20be9e150c Polishing 2024-03-09 14:28:01 +01:00
Sam Brannen 122372c580 Spring cleaning: update copyright headers 2024-02-23 12:21:22 +01:00
Sam Brannen c98bebd6d3 Spring cleaning: add missing @⁠Override annotations 2024-02-23 12:20:11 +01:00
Stéphane Nicoll f526b23fd7 Harmonize WebSocket message broker to use Executor
This commit harmonizes the configuration of the WebSocket message
broker to use Executor rather than TaskExecutor as only the former
is enforced. This lets custom configuration to use a wider range
of implementations.

Closes gh-32129
2024-02-15 14:59:42 +01:00
rstoyanchev 78f0688ed0 Fix javadoc error
See gh-32205
2024-02-14 16:48:58 +00:00
rstoyanchev 504b7619bd WebSocketMessageBrokerConfigurer allows to configure Lifecycle phase
Closes gh-32205
2024-02-14 16:26:33 +00:00
rstoyanchev 2dd22f64e1 Improve cancellation of read/write inactivity
The cancellation of read and write inactivity tasks was done via
WebSocketHandler#afterConnectionClosed, relying on the WebSocket
library to always invoke the callback.

This change moves the cancellation to the `close` method instead
that in turn is called from DefaultStompSession#resetConnection,
in effect making the cancellation more proactive and aligned with
connection cleanup in DefaultStompSession vs relying on a
subsequent call from the WebSocket library after the connection
is closed.

Closes gh-32195
2024-02-13 11:17:34 +00:00
rstoyanchev 6a5953dca3 Polishing in WebSocketStompClient
See gh-32195
2024-02-13 11:17:34 +00:00
Juergen Hoeller b4153618a4 Consistent Lock field declaration (instead of ReentrantLock field type) 2024-02-13 11:07:20 +01:00
rstoyanchev 5851cdc679 Refine invocation of checkSessions
It makes more sense to call this from afterConnectionEstablished as it
relates to the creation of new sessions.

See gh-32195
2024-02-12 12:50:45 +00:00
Stéphane Nicoll 122d8b9e4e Polish 2024-01-12 14:55:21 +01:00
Stéphane Nicoll 1f2d29ee08 Polish 2024-01-08 17:12:33 +01:00
Juergen Hoeller f5b4f7d9e8 Support for SSLContext configuration on StandardWebSocketClient
Closes gh-30680
2023-12-28 23:42:04 +01:00
Juergen Hoeller 989625d2d4 Allow SockJsUrlInfo to be overridden in SockJsClient
Closes gh-25888
2023-12-28 20:56:18 +01:00
Stéphane Nicoll eefe65d95a Upgrade copyright year of changed files
See gh-31916
2023-12-28 13:36:58 +01:00
Yanming Zhou ea5ef098cf Use Map.computeIfAbsent() where feasible
See gh-31916
2023-12-28 13:23:48 +01:00
Stéphane Nicoll a6e87b40c7 Polish "Use diamond operator where feasible"
See gh-31916
2023-12-28 13:14:26 +01:00
Yanming Zhou 094479b55f Use diamond operator where feasible
See gh-31916
2023-12-28 13:08:08 +01:00
Yanming Zhou 4a450c6fab Use enhanced for loop where feasible
See gh-31916
2023-12-28 13:01:44 +01:00
Baoyi Chen e00a882333 Complete Jetty frame callback when opcode is not PONG
The onWebSocketFrame method should complete callback.
For more details, see https://github.com/jetty/jetty.project/issues/11088.

Closes gh-31869
2023-12-21 17:56:26 +01:00
Arjen Poutsma 24f8eac12a Improve ByteBuffer copy method
This commit improves JettyWebSocketHandlerAdapter::copyByteBuffer so
that it allocates a buffer large enough for the remaining bytes
contained in the source, instead of allocating one with the capacity of
the source.

Closes gh-31857
2023-12-18 15:23:27 +01:00
Stéphane Nicoll d0574197ea Polish "Use String.repeat instead of explicit cycle"
See gh-31802
2023-12-18 14:10:16 +01:00
Adam Ostrožlík 63b2787da6 Use String.repeat instead of explicit cycle
See gh-31802
2023-12-18 13:54:03 +01:00
Yanming Zhou afcd03bddc Replace assertThat(x.isEmpty()).isTrue() with assertThat(x).isEmpty()
Search for   : assertThat\((.+).isEmpty\(\)\).isTrue\(\)
Replace with : assertThat($1).isEmpty()

Search for   : assertThat\((.+).isEmpty\(\)\).isFalse\(\)
Replace with : assertThat($1).isNotEmpty()

Closes gh-31758
2023-12-06 10:04:56 +01:00
Yanming Zhou e2852e7355 Replace assertThat(x.contains(y)).isTrue() with assertThat(x).contains(y)
Search for   : assertThat\((.+)\.contains\((.+)\)\)\.isTrue\(\)
Replace with : assertThat($1).contains($2)

Search for   : assertThat\((.+)\.contains\((.+)\)\)\.isFalse\(\)
Replace with : assertThat($1).doesNotContain($2)

Closes gh-31762
2023-12-06 09:48:49 +01:00
Yanming Zhou 59815cefce Replace assertThat(x.get(i)). with assertThat(x).element(i).
Search for   : assertThat\((.+)\.get\((\d+)\)\)\.
Replace with : assertThat($1).element($2).

Closes gh-31759
2023-12-06 09:43:59 +01:00
Yanming Zhou 6f11716b6f Use idiomatic AssertJ map assertions
See gh-31752
2023-12-05 10:01:38 +01:00
rstoyanchev 0e6e225fb9 Implement messageSize methods in JettyWebSocketSession
Closes gh-28325
2023-11-30 13:10:17 +00:00
Stéphane Nicoll f8a40555af Upgrade copyright year of changed file
See gh-31694
2023-11-28 12:53:54 +01:00
Yanming Zhou 64d5e904e8 Use AssertJ isInstanceOf where feasible
See gh-31694
2023-11-28 12:49:32 +01:00
Stéphane Nicoll 4e2d357318 Remove list of supported websocket servers
This commit removes a list of hardcoded servers and version as this is
bound to get outdated and the reference guide/wiki is a more suitable
place for this.
2023-11-27 16:31:09 +01:00
Stéphane Nicoll 264ec517f2 Polish 2023-11-27 16:31:09 +01:00
rstoyanchev 8ffbecc7c3 WebSocketMessageBrokerStats implements SmartInitializingSingleton
Closes gh-26536
2023-11-21 17:58:00 +00:00
Juergen Hoeller fff50657d2 Polishing 2023-11-20 21:01:40 +01:00
Stéphane Nicoll f5453cc445 Polish 2023-11-10 16:42:43 +01:00