Priority Blocking Queue ... Is it a Bug??
807606May 21 2007 — edited May 22 2007Sorry for posting code. I have my reputition of explaing things in wrong way. So consider me. Any way I am getting ClassCastException when i am trying to run this Could any one alter this and post back so that it wont give any exceptions
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.PriorityBlockingQueue;
public class Test {
private BlockingQueue<Inter> bQueue = new PriorityBlockingQueue<Inter>();
public static void main(String args[]) {
Test test = new Test();
test.add(new InterImpl());
test.add(new InterImpl());
test.add(new InterImpl());
test.add(new InterImpl());
test.add(new InterImpl());
test.add(new InterImpl());
}
public void add(Inter inter) {
bQueue.add(inter);
}
}
class InterImpl implements Inter{
public void show() {
System.out.println("Showing InterImpl");
}
}
interface Inter {
public void show();
}