Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package it.dstech.cloud.beans;
- import java.util.concurrent.Future;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.scheduling.annotation.Async;
- import org.springframework.scheduling.annotation.AsyncResult;
- public class TestAsync {
- static final Logger logger = LoggerFactory.getLogger(TestAsync.class);
- public TestAsync() {
- }
- @Async
- public Future<String> call(){
- try {
- Thread currentThread = Thread.currentThread();
- logger.debug(currentThread.getName());
- Thread.sleep(10000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- return new AsyncResult<>("Ciao");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement