Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Slf4j
- public class Service {
- @Data
- public static final class Request {
- String originalXmlRequest;
- Node root;
- }
- private final ExecutorService executor = Executors.newFixedThreadPool(1);
- public void enqueue(Request req) {
- LOGGER.info("Got XML: {}", req.originalXmlRequest);
- executor.execute(() -> process(req.root));
- }
- private synchronized void process(Node root) {
- // do stuff on parsed xml DOM tree starting on 'root'
- Thread.sleep(5000);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement