Package co.paralleluniverse.actors.ActorImpl

Examples of co.paralleluniverse.actors.ActorImpl.ActorLifecycleListener


     * @see #link(ActorRef)
     * @see #unwatch(ActorRef, Object)
     */
    public final Object watch(ActorRef other) {
        final Object id = ActorUtil.randtag();
        final LifecycleListener listener = new ActorLifecycleListener(myRef(), id);
        record(1, "Actor", "watch", "Actor %s to watch %s (listener: %s)", this, other, listener);
        final ActorImpl other1 = getActorRefImpl(other);
        other1.addLifecycleListener(listener);
        observed.add(other1);
        return id;
View Full Code Here


     * @param other   the other actor
     * @param watchId the object returned from the call to {@link #watch(ActorRef) watch(other)}
     * @see #watch(ActorRef)
     */
    public final void unwatch(ActorRef other, Object watchId) {
        final LifecycleListener listener = new ActorLifecycleListener(myRef(), watchId);
        record(1, "Actor", "unwatch", "Actor %s to stop watching %s (listener: %s)", this, other, listener);
        final ActorImpl other1 = getActorRefImpl(other);
        other1.removeLifecycleListener(listener);
        observed.remove(getActorRefImpl(other));
    }
View Full Code Here

                record(1, "Actor", "die", "Actor %s notifying listener %s of death failed with excetpion %s", this, listener, e);
            }

            // avoid memory leak in links:
            if (listener instanceof ActorLifecycleListener) {
                ActorLifecycleListener l = (ActorLifecycleListener) listener;
                if (l.getId() == null) // link
                    l.getObserver().getImpl().removeObserverListeners(myRef());
            }
        }

        // avoid memory leaks:
        lifecycleListeners.clear();
View Full Code Here

     * @see #link(ActorRef)
     * @see #unwatch(ActorRef, Object)
     */
    public final Object watch(ActorRef other) {
        final Object id = ActorUtil.randtag();
        final LifecycleListener listener = new ActorLifecycleListener(myRef(), id);
        record(1, "Actor", "watch", "Actor %s to watch %s (listener: %s)", this, other, listener);
        final ActorImpl other1 = getActorRefImpl(other);
        other1.addLifecycleListener(listener);
        observed.add(other1);
        return id;
View Full Code Here

     * @param other   the other actor
     * @param watchId the object returned from the call to {@link #watch(ActorRef) watch(other)}
     * @see #watch(ActorRef)
     */
    public final void unwatch(ActorRef other, Object watchId) {
        final LifecycleListener listener = new ActorLifecycleListener(myRef(), watchId);
        record(1, "Actor", "unwatch", "Actor %s to stop watching %s (listener: %s)", this, other, listener);
        final ActorImpl other1 = getActorRefImpl(other);
        other1.removeLifecycleListener(listener);
        observed.remove(getActorRefImpl(other));
    }
View Full Code Here

                record(1, "Actor", "die", "Actor %s notifying listener %s of death failed with excetpion %s", this, listener, e);
            }

            // avoid memory leak in links:
            if (listener instanceof ActorLifecycleListener) {
                ActorLifecycleListener l = (ActorLifecycleListener) listener;
                if (l.getId() == null) // link
                    l.getObserver().getImpl().removeObserverListeners(myRef());
            }
        }

        // avoid memory leaks:
        lifecycleListeners.clear();
View Full Code Here

TOP

Related Classes of co.paralleluniverse.actors.ActorImpl.ActorLifecycleListener

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.