Let me go through your code.
static class FIFOEntry<E extends Comparable<? super E>> implements Comparable<FIFOEntry<E>> {
This defines a FIFOEntry class that accepts a generic parameter. You have limited the type of the general parameter "Any object that implements" Comparable by itself ".
private static PriorityBlockingQueue<FIFOEntry<FIFOPBQEvent>> theQueue = PriorityBlockingQueue<FIFOEntry<FIFOPBQEvent>>();
Your PriorityBlockingQueue declaration here is incorrect, but your FIFOEntry<FIFOPBQEvent> is incorrect. This is because of the above - you have limited the FIFOEntry type to everything that implements the Comparable from itself, that is, it should be
class FIFOPBQEvent implements Comparable<FIFOPBQEvent> {
Your next problem is
public void sendEvent() { theQueue.put(this); }
This type is FIFOPBQEvent , but the queue accepts only FIFOEntry objects. To match your queue signature, it should be:
public void sendEvent() {
You also have a problem on receiveEvent() - your signature in the queue indicates that the queue contains FIFOEntry objects, and you are trying to pull FIFOPBQEvents.
Bringer128
source share