## §5.3 Implicit team activation

Implicit team activation is intended to ensure that whenever the control flow is passed to a team or one of its roles, the team is implicitly activated for the current thread. Implicit activation can be configured at different levels (see §5.3.(d)).

When implicit activation is enabled a programmer may assume, that whenever a role forwards calls to its base object via callout, the callin bindings of the same role will be active at that time. Exceptions to this rule have to be programmed explicitly.

#### (a) Team level methods

While executing a team level method, the target team is always active. Activation is reset to the previous state when leaving the team method, unless the team has been explicitly activated during execution of the team method by a call to `activate()`. Explicit activation is stronger than implicit activation and thus persists after the team level method terminates. Ie., leaving a team level method will never reset an explicit activation.

#### (b) Methods of externalized roles

Invoking a method on an externalized role (see §1.2.2) also has the effect of temporary activation of the team containing the role for the current thread. Regarding deactivation the rule of §5.3.(a) above applies accordingly.

#### (c) Nested teams

Implicit activation has additional consequences for nested teams (see §1.5):

- Implicit activation of a team causes the activation of its outer teams.
- Implicit deactivation of a team causes the deactivation of its inner teams.

#### (d) Configuring implicit activation

Implicit activation is disabled by default and can be enabled by adding the annotation `@org.objectteams.ImplicitTeamActivation`, which can be applied to a type or a method. When applied to a method it is ensured that invoking this method will trigger implicit activation. When the annotation is applied to a type this has the same effect as applying it to all externally visible methods of the type. Member types are not affected and have to be annotated separately.

The runtime environment can be configured globally by defining the system property `ot.implicit.team.activation` to one of these values:

NEVER
  Implicit activation is completely disabled.
ANNOTATED
  This is the default: implicit activation applies only where declared by `@ImplicitTeamActivation`.
ALWAYS
  Implicit activation applies to all externally visible methods (this was the default in OTJLD versions ≤1.2)

Note that among the different mechanisms for activation, `within` is strongest, followed by `(de)activate()`, weakest is implicit activation. In this sense, explicit imperative (de)activation may override the block structure of implicit activation (by explicit activation within a team level method), but not that of a `within` block (by deactivation from a within block).