Package org.apache.hivemind.util

Examples of org.apache.hivemind.util.EventListenerList


    public synchronized void addRegistryShutdownListener(
            RegistryShutdownListener s)
    {
        if (_listenerList == null)
            _listenerList = new EventListenerList();

        _listenerList.addListener(s);
    }
View Full Code Here


{
    private ThreadLocal _storage = new ThreadLocal();

    public void addThreadCleanupListener(ThreadCleanupListener listener)
    {
        EventListenerList list = (EventListenerList) _storage.get();

        if (list == null)
        {
            list = new EventListenerList();
            _storage.set(list);
        }

        list.addListener(listener);
    }
View Full Code Here

        list.addListener(listener);
    }

    public void removeThreadCleanupListener(ThreadCleanupListener listener)
    {
    EventListenerList list = (EventListenerList) _storage.get();

        if (list != null)
            list.removeListener(listener);
    }
View Full Code Here

    {
        // Here's where we need the CursorableLinkedList since listeners
        // are free to unregister as listeners from threadDidCleanup() and
        // we need to avoid concurrent modification errors.

    EventListenerList list = (EventListenerList) _storage.get();

        if (list == null)
            return;

        Iterator i = list.getListeners();

        while (i.hasNext())
        {
            ThreadCleanupListener listener = (ThreadCleanupListener) i.next();
View Full Code Here

    public synchronized void addRegistryShutdownListener(
            RegistryShutdownListener s)
    {
        if (_listenerList == null)
            _listenerList = new EventListenerList();

        _listenerList.addListener(s);
    }
View Full Code Here

    private EventListenerList _listenerList;

    public synchronized void addRegistryShutdownListener(RegistryShutdownListener s)
    {
        if (_listenerList == null)
            _listenerList = new EventListenerList();

        _listenerList.addListener(s);
    }
View Full Code Here

            assertEquals(true, t[i].isTrigger());
    }

    public void testBasic()
    {
        EventListenerList l = new EventListenerList();

        Trigger[] ta = buildTriggers(20);

        addAll(l, ta);

        Iterator i = l.getListeners();

        while (i.hasNext())
        {
            Trigger t = (Trigger) i.next();
View Full Code Here

    }

    public void testEmptyList()
    {
        EventListenerList l = new EventListenerList();

        Iterator i = l.getListeners();

        assertEquals(false, i.hasNext());
    }
View Full Code Here

    }

    public void testLateAdd()
    {
        Trigger[] ta = buildTriggers(20);
        EventListenerList l = new EventListenerList();

        addAll(l, ta);

        Iterator i = l.getListeners();

        for (int j = 0; j < 5; j++)
        {
            Trigger t = (Trigger) i.next();
            t.setTrigger(true);
        }

        Trigger tnew = new Trigger();
        l.addListener(tnew);

        while (i.hasNext())
        {
            Trigger t = (Trigger) i.next();
            t.setTrigger(true);
View Full Code Here

    }

    public void testLateRemove()
    {
        Trigger[] ta = buildTriggers(20);
        EventListenerList l = new EventListenerList();

        addAll(l, ta);

        Iterator i = l.getListeners();

        for (int j = 0; j < 5; j++)
        {
            Trigger t = (Trigger) i.next();
            t.setTrigger(true);
        }

        Trigger tremoved = ta[15];
        l.removeListener(tremoved);

        while (i.hasNext())
        {
            Trigger t = (Trigger) i.next();
            t.setTrigger(true);
View Full Code Here

TOP

Related Classes of org.apache.hivemind.util.EventListenerList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.