public static AbstractActor<?> currentActor() { ActorTaskContext current = current(); return current != null ? current.getActor() : null; } }
/** * Sets the runtime associated with the current thread. * <p> * It also tries to set the static runtime if the previous one got garbage collected. * </p> * <p> It's not necessary to "unset" the runtime because: * <ol> * <li>there should normally exist only one (only test cases are expected to have more than one)</li> * <li>it is already a weak reference</li> * <li>if another runtime is using the same thread later (shared thread pools) it will set the runtime before each usage</li> * </ol></p> * * @param runtimeRef a reference to the runtime */ public static void setRuntime(final WeakReference<? extends BasicRuntime> runtimeRef) { if (runtimeRef.get() instanceof ActorRuntime) { final ActorTaskContext context = ActorTaskContext.current(); if (context != null) { context.setRuntime((ActorRuntime) runtimeRef.get()); } } currentRuntime.set(runtimeRef); lastRuntime = runtimeRef; }
final ActorTaskContext context = ActorTaskContext.current(); if (context != null)
private String getFrom(final RemoteReference reference, final Method method) final ActorTaskContext context = ActorTaskContext.current(); String from; if (context != null && context.getActor() != null)
private String getFrom(final RemoteReference reference, final Method method) final ActorTaskContext context = ActorTaskContext.current(); String from; if (context != null && context.getActor() != null)
final ActorTaskContext oldContext = ActorTaskContext.current(); final ActorTaskContext context = oldContext != null ? oldContext.cloneContext() : new ActorTaskContext();