Advertisement
Guest User

Untitled

a guest
Mar 20th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.53 KB | None | 0 0
  1. @Slf4j
  2. public class Service {
  3.     @Data
  4.     public static final class Request {
  5.         String originalXmlRequest;
  6.         Node root;
  7.     }
  8.  
  9.     private final ExecutorService executor = Executors.newFixedThreadPool(1);
  10.  
  11.     public void enqueue(Request req) {
  12.         LOGGER.info("Got XML: {}", req.originalXmlRequest);
  13.         executor.execute(() -> process(req.root));
  14.     }
  15.  
  16.     private synchronized void process(Node root) {
  17.         // do stuff on parsed xml DOM tree starting on 'root'
  18.         Thread.sleep(5000);
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement