Bael 1555 - Improve Example (#4852)
* BAEL-1555 * Corrected indents and spacing * RequestMapping to GetMapping * Improved Performance For Concurrent Users
This commit is contained in:
parent
aabbd93fcf
commit
a1213549f3
|
@ -13,11 +13,11 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter
|
|||
|
||||
@Controller
|
||||
public class ResponseBodyEmitterController {
|
||||
private ExecutorService nonBlockingService = Executors.newSingleThreadExecutor();
|
||||
|
||||
@GetMapping(Constants.API_RBE)
|
||||
public ResponseEntity<ResponseBodyEmitter> handleRbe() {
|
||||
ResponseBodyEmitter emitter = new ResponseBodyEmitter();
|
||||
ExecutorService nonBlockingService = Executors.newSingleThreadExecutor();
|
||||
|
||||
nonBlockingService.execute(() -> {
|
||||
try {
|
||||
|
|
|
@ -10,12 +10,12 @@ import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
|||
|
||||
@Controller
|
||||
public class SseEmitterController {
|
||||
private ExecutorService nonBlockingService = Executors.newSingleThreadExecutor();
|
||||
|
||||
@GetMapping(Constants.API_SSE)
|
||||
public SseEmitter handleSse() {
|
||||
SseEmitter emitter = new SseEmitter();
|
||||
|
||||
ExecutorService nonBlockingService = Executors.newSingleThreadExecutor();
|
||||
nonBlockingService.execute(() -> {
|
||||
try {
|
||||
emitter.send(Constants.API_SSE_MSG + " @ " + new Date());
|
||||
|
|
Loading…
Reference in New Issue