Package org.jtrim.event

Examples of org.jtrim.event.InitLaterListenerRef


    protected final GradleProjectPlatformQuery trySetQuery(GradleProjectPlatformQuery query) {
        ExceptionHelper.checkNotNullArgument(query, "query");

        if (queryRef.compareAndSet(null, query)) {
            ListenerRef toRemove = null;
            InitLaterListenerRef toAdd = null;

            changesLock.lock();
            try {
                if (changes.hasListeners()) {
                    toRemove = subListenerRef;
                    toAdd = new InitLaterListenerRef();
                    subListenerRef = toAdd;
                }
            } finally {
                changesLock.unlock();
            }

            if (toRemove != null) {
                toRemove.unregister();
            }
            if (toAdd != null) {
                toAdd.init(query.addPlatformChangeListener(new Runnable() {
                    @Override
                    public void run() {
                        firePlatformChange();
                    }
                }));
View Full Code Here


    }

    @Override
    public final void addChangeListener(ChangeListener listener) {
        ListenerRef toRemove = null;
        InitLaterListenerRef toAdd = null;
        GradleProjectPlatformQuery query = queryRef.get();

        changesLock.lock();
        try {
            if (!changes.hasListeners() && query != null) {
                toRemove = subListenerRef;
                toAdd = new InitLaterListenerRef();
                subListenerRef = toAdd;
            }
            changes.addChangeListener(listener);
        } finally {
            changesLock.unlock();
        }

        if (toRemove != null) {
            toRemove.unregister();
        }
        if (toAdd != null) {
            assert query != null;
            toAdd.init(query.addPlatformChangeListener(new Runnable() {
                @Override
                public void run() {
                    changes.fireChange();
                }
            }));
View Full Code Here

TOP

Related Classes of org.jtrim.event.InitLaterListenerRef

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.