public ObjectInvoker<?> getInvoker(final int interfaceId) { final ClassDescriptor descriptor = getDescriptor(interfaceId); if (descriptor == null) { return getInvoker(DefaultClassDictionary.get().getClassById(interfaceId)); } if (descriptor.invoker == null) { descriptor.invoker = dynamicReferenceFactory.getInvokerFor(descriptor.factory.getInterface()); } return descriptor.invoker; }
@Override public void onRead(final HandlerContext ctx, final Object msg) throws Exception { Message message = (Message) msg; final Class<?> clazz = DefaultClassDictionary.get().getClassById(message.getInterfaceId()); // TODO: check method access, check object access } }
public Object interceptStateMethod( final Method method, final String event, final Object[] args) { return ((ActorState) state()).invokeEvent(event, args); }
default ObjectInvoker<?> getInvoker(int classId) { return getInvoker(DefaultClassDictionary.get().getClassById(classId)); }
default ObjectInvoker<?> getInvoker(Class clazz) { return DefaultDescriptorFactory.get().getInvoker(clazz); }
@Override public <T> T getReference(final BasicRuntime runtime, final NodeAddress address, final Class<T> iClass, final Object id) { if (address != null) { return stage.getReference(address, iClass, id); } else { return DefaultDescriptorFactory.get().getReference(this, address, iClass, id); } }
@SuppressWarnings("unchecked") public static <R> Class<R> getInterfaceClass(final AbstractActor reference) { return from(reference)._interfaceClass(); }
@Override public ObjectInvoker<?> getInvoker(Class clazz) { final ClassDescriptor descriptor = getDescriptor(clazz); if (descriptor == null) { return null; } if (descriptor.invoker == null) { descriptor.invoker = dynamicReferenceFactory.getInvokerFor(clazz); } return descriptor.invoker; }
/** * Creates a new actor task context and pushes it to the current thread context stack. * * @return the new execution context */ public static ActorTaskContext pushNew() { final ActorTaskContext context = new ActorTaskContext(); context.push(); return context; }
default <T> T getReference(Class<T> iClass, Object id) { return getReference(null, null, iClass, id); }
static <DATA> AsyncStream<DATA> getStream(Class<DATA> dataClass, String provider, String streamId) { return BasicRuntime.getRuntime().getStream(provider, dataClass, streamId); } }
@Override protected void createDefaultState() { super.createDefaultState(); }
/** * Sets a static reference to the last created runtime. * * @param runtimeRef a reference to the runtime */ static void setRuntime(final WeakReference<ActorRuntime> runtimeRef) { RuntimeBinder.setRuntime(runtimeRef); }
/** * Gets a string that represents uniquely the node that currently holds this actor. * * @return unique identity string */ protected String runtimeIdentity() { return runtime.runtimeIdentity(); }
/** * Removes a previously registered reminder. * * @param reminderName the remainder's name * @return completion promise for this operation */ protected Task<?> unregisterReminder(String reminderName) { return runtime.unregisterReminder((Remindable) reference, reminderName); }
/** * Returns an actor reference */ default <T> T getReference(final Class<T> iClass, final Object id) { return getReference(this, null, iClass, id); }
protected StreamProvider getStreamProvider(String name) { StreamProvider provider = runtime.getStreamProvider(name); // obs.: the actor runtime wraps the StreamProvider // to use an actor executor for call backs // and to ensure that the actor unsubscribes on deactivation. return provider; } }
protected AbstractActor() { this.createDefaultState(); }
/** * Sets a static reference to the last created runtime. * * @param runtimeRef a reference to the runtime */ static void setRuntime(final WeakReference<? extends BasicRuntime> runtimeRef) { RuntimeBinder.setRuntime(runtimeRef); }