Bael 1555 - Improve Example (#4852)

* BAEL-1555

* Corrected indents and spacing

* RequestMapping to GetMapping

* Improved Performance For Concurrent Users
This commit is contained in:
Adam InTae Gerard 2018-07-30 22:41:59 -07:00 committed by Grzegorz Piwowarek
parent aabbd93fcf
commit a1213549f3
2 changed files with 2 additions and 2 deletions

View File

@ -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 {

View File

@ -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());