All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.java.openjdk.cacio.ctc.CTCEventSource Maven / Gradle / Ivy

package net.java.openjdk.cacio.ctc;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

import sun.awt.peer.cacio.CacioEventSource;
import sun.awt.peer.cacio.managed.EventData;

public class CTCEventSource implements CacioEventSource {

    private static CTCEventSource instance;

    static CTCEventSource getInstance() {
        if (instance == null) {
            instance = new CTCEventSource();
        }
        return instance;
    }

    private BlockingQueue queue = new LinkedBlockingQueue();

    private CTCEventSource() {
        // Singleton.
    }

    @Override
    public EventData getNextEvent() throws InterruptedException {
        return queue.take();
    }

    void postEvent(EventData ev) {
        queue.offer(ev);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy