mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-17 12:59:54 +00:00
#108 Consistent package naming throughout the examples
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package com.iluwatar.poison.pill;
|
||||
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
/**
|
||||
* Bounded blocking queue wrapper
|
||||
*/
|
||||
public class SimpleMessageQueue implements MessageQueue {
|
||||
|
||||
private final BlockingQueue<Message> queue;
|
||||
|
||||
public SimpleMessageQueue(int bound) {
|
||||
queue = new ArrayBlockingQueue<Message>(bound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(Message msg) throws InterruptedException {
|
||||
queue.put(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Message take() throws InterruptedException {
|
||||
return queue.take();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user