Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package domain;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.logging.Level;
- import java.util.logging.Logger;
- /**
- *
- * @author crownedzero
- */
- public class Consumer implements Runnable {
- private List<Message> consumerList = new ArrayList<>();
- @Override
- public void run() {
- while (true) {
- try {
- Message tempMessage = Producer.messageConsume(Thread.currentThread().getName());
- if (tempMessage.getRegion().equalsIgnoreCase(Thread.currentThread().getName())) {
- consumerList.add(tempMessage);
- } Thread.sleep(500);
- } catch (InterruptedException ex) {
- Logger.getLogger(Consumer.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement