Skip to content

Commit a121354

Browse files
Thoughtscriptpivovarit
authored andcommitted
Bael 1555 - Improve Example (eugenp#4852)
* BAEL-1555 * Corrected indents and spacing * RequestMapping to GetMapping * Improved Performance For Concurrent Users
1 parent aabbd93 commit a121354

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎spring-5-mvc/src/main/java/com/baeldung/web/ResponseBodyEmitterController.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313

1414
@Controller
1515
public class ResponseBodyEmitterController {
16+
private ExecutorService nonBlockingService = Executors.newSingleThreadExecutor();
1617

1718
@GetMapping(Constants.API_RBE)
1819
public ResponseEntity<ResponseBodyEmitter> handleRbe() {
1920
ResponseBodyEmitter emitter = new ResponseBodyEmitter();
20-
ExecutorService nonBlockingService = Executors.newSingleThreadExecutor();
2121

2222
nonBlockingService.execute(() -> {
2323
try {

‎spring-5-mvc/src/main/java/com/baeldung/web/SseEmitterController.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010

1111
@Controller
1212
public class SseEmitterController {
13+
private ExecutorService nonBlockingService = Executors.newSingleThreadExecutor();
1314

1415
@GetMapping(Constants.API_SSE)
1516
public SseEmitter handleSse() {
1617
SseEmitter emitter = new SseEmitter();
1718

18-
ExecutorService nonBlockingService = Executors.newSingleThreadExecutor();
1919
nonBlockingService.execute(() -> {
2020
try {
2121
emitter.send(Constants.API_SSE_MSG + " @ " + new Date());

0 commit comments

Comments
 (0)