Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Concepts: Useful Annotations

Joe Hegarty edited this pageNov 10, 2017 ·11 revisions

Actor Interface Annotations

StatelessWorker

@StatelessWorkerinterfaceMyActorextendsActor {}

Causes your actor to be a stateless worker. Seestateless workers.

NoIdentity

@NoIdentityinterfaceMyActorextendsActor {}

Denotes that this actor does not have an identity and acts as a singleton. Actor is accessed using Actor.getReference(clazz) instead of Actor.getReference(clazz, id).

PreferLocalPlacement

@PreferLocalPlacement(percentile=100)interfaceMyActorextendsActor {}

Denotes that this actor should prefer to be placed locally if not already activated and the local node is capable of hosting it. Optional percentile value allows developers to define the likelihood of preferring local placement (default 100).

NeverDeactivate

@NeverDeactivateinterfaceMyActorextendsActor {}

Denotes that this actor should prefer not to deactivate once it has been activated, overriding the default deactivation due to inactivity.Please Note: This is a hint, the actor will not start automatically and may still be deactivated in the case of node failure. Applications should ping the actor regularly if they need to ensure it is always alive.

TimeToLive

@TimeToLive(value=10,timeUnit=TimeUnit.MINUTES)interfaceMyActorextendsActor {}

Overrides the default time to live on an actor type.

Message Interface Annotations

OneWay

@OneWayTasksomeMessage();

This message is OneWay. No result (value or status) will be returned, no guarantee that message will be processed.The Task might contain an exception if there was a problem locating the target object or serializing the message.

OnlyIfActivated

@OnlyIfActivatedTasksomeMessage();

This message is only executed if the actor has already been activated. Unlike normal messages, this will not cause an actor to activate.

CacheResponse

@CacheResponse(maxEntries =1000,ttlDuration =5,ttlUnit =TimeUnit.SECONDS)Task<String>getAccountName(intid);

This message caches its result, on a per actor, per parameter-set basis. The data persists for the given duration, or until at least the specified number of entries has been reached (whichever constraint is encountered first). Cached values are not guaranteed to immediately evict once maxEntries has been reached.

Caches can be force-flushed using ExecutionCacheFlushManager.

Timeout

@Timeout(value=10,timeUnit=TimeUnit.SECONDS)Task <String>getAccountName();

Overrides the default message timeout for the given actor message.

Message Implementation Annotations

Reentrant

@ReentrantTask<Void>doSomething() {}

Causes your message to be reentrant. Seereentrancy.

SkipUpdateLastAccess

@SkipUpdateLastAccessTask<Void>doSomething() {}

Does not update the actors last access time thus preventing the message from extending the actor time to live.

DTO Annotations

Immutable

@ImmutableclassSomeMessageDTO {}

Denotes that an object is considered immutable and therefore the framework does not need to clone it. The application must ensure that the object is actually immutable and does not change once it has been passed to the framework.

Developed byElectronic Arts.Licensed under theBSD 3-Clause License.

Clone this wiki locally


[8]ページ先頭

©2009-2026 Movatter.jp