Package co.paralleluniverse.actors.ActorRefImpl

Examples of co.paralleluniverse.actors.ActorRefImpl.ActorLifecycleListener


     */
    public final Object watch(ActorRef other) {
        final Object id = ActorUtil.randtag();

        final ActorRefImpl other1 = getActorRefImpl(other);
        final LifecycleListener listener = new ActorLifecycleListener(ref, id);
        record(1, "Actor", "watch", "Actor %s to watch %s (listener: %s)", this, other1, listener);

        other1.addLifecycleListener(listener);
        observed.add(other1);
        return id;
View Full Code Here


     * @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 ActorRefImpl other1 = getActorRefImpl(other);
        final LifecycleListener listener = new ActorLifecycleListener(ref, watchId);
        record(1, "Actor", "unwatch", "Actor %s to stop watching %s (listener: %s)", this, other1, listener);
        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().removeObserverListeners(myRef());
            }
        }

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

    public final Object watch(ActorRef other1) {
        final Object id = ActorUtil.randtag();

        final ActorRefImpl other = getActorImpl(other1);
        final LifecycleListener listener = new ActorLifecycleListener(ref, id);
        record(1, "Actor", "watch", "Actor %s to watch %s (listener: %s)", this, other, listener);

        other.addLifecycleListener(listener);
        observed.add(other);
        return id;
View Full Code Here

        return id;
    }

    public final void unwatch(ActorRef other1, Object watchId) {
        final ActorRefImpl other = getActorImpl(other1);
        final LifecycleListener listener = new ActorLifecycleListener(ref, watchId);
        record(1, "Actor", "unwatch", "Actor %s to stop watching %s (listener: %s)", this, other, listener);
        other.removeLifecycleListener(listener);
        observed.remove(getActorImpl(other1));
    }
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().removeObserverListeners(myRef());
            }
        }

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

     */
    public final Object watch(ActorRef other) {
        final Object id = ActorUtil.randtag();

        final ActorRefImpl other1 = getActorRefImpl(other);
        final LifecycleListener listener = new ActorLifecycleListener(ref, id);
        record(1, "Actor", "watch", "Actor %s to watch %s (listener: %s)", this, other1, listener);

        other1.addLifecycleListener(listener);
        observed.add(other1);
        return id;
View Full Code Here

     * @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 ActorRefImpl other1 = getActorRefImpl(other);
        final LifecycleListener listener = new ActorLifecycleListener(ref, watchId);
        record(1, "Actor", "unwatch", "Actor %s to stop watching %s (listener: %s)", this, other1, listener);
        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().removeObserverListeners(myRef());
            }
        }

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

TOP

Related Classes of co.paralleluniverse.actors.ActorRefImpl.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.