Permalink
Browse files

Added method declarations returnin generic return type in IQueue inte…

…rface to make it work in java8.
  • Loading branch information...
mdogan committed Nov 14, 2014
1 parent 86c3c59 commit 81581a2d11dfcc535c2549a222a8dbd054f8669d
@@ -19,6 +19,7 @@
import com.hazelcast.monitor.LocalQueueStats;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
/**
* Concurrent, blocking, distributed, observable queue.
@@ -34,6 +35,24 @@
*/
public interface IQueue<E> extends BlockingQueue<E>, BaseQueue<E>, ICollection<E> {
/*
* Added poll(), poll(long timeout, TimeUnit unit) and take()
* methods here to prevent wrong method return type issue when
* compiled with java 8.
*
* For additional details see;
*
* http://mail.openjdk.java.net/pipermail/compiler-dev/2014-November/009139.html
* https://bugs.openjdk.java.net/browse/JDK-8064803
*
*/
E poll();
E poll(long timeout, TimeUnit unit) throws InterruptedException;
E take() throws InterruptedException;
/**
* Returns LocalQueueStats for this queue.
* LocalQueueStats is the statistics for the local portion of this
@@ -57,7 +57,7 @@ public void testQueueItemListener() throws InterruptedException {
final CountDownLatch latch = new CountDownLatch(8);
final String value = "hello";
final HazelcastInstance instance = createHazelcastInstance();
IQueue queue = instance.getQueue("testQueueItemListener");
IQueue<String> queue = instance.getQueue("testQueueItemListener");
queue.addItemListener(new ItemListener<String>() {
public void itemAdded(ItemEvent<String> itemEvent) {

0 comments on commit 81581a2

Please sign in to comment.