apex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sanjay Pujare <san...@datatorrent.com>
Subject Re: Difference between setup() and activate()
Date Sun, 30 Jul 2017 02:58:53 GMT
The Javadoc comment
for com.datatorrent.api.Operator.ActivationListener<CONTEXT>  (in
https://github.com/apache/apex-core/blob/master/api/src/main/java/com/datatorrent/api/Operator.java)
should hopefully answer your questions.

Specifically:

1. No, setup() is called only once in the entire lifetime (
http://apex.apache.org/docs/apex/operator_development/#setup-call)

2. Yes. When an operator is "activated" - first time in its life or
reactivation after a failover -  actuvate() is called before the first
beginWindow() is called.

3. Yes.


On Sun, Jul 30, 2017 at 12:18 AM, Ananth G <ananthg.apex@gmail.com> wrote:

> Hello All,
>
> I was looking at the documentation and could not get a clear distinction
> of behaviours for setup() and activate() during scenarios when an operator
> is passivated ( ex: application shutdown, repartition use cases ) and being
> brought back to life again. Could someone from the community advise me on
> the following questions ?
>
> 1. Is setup() called in these scenarios (serialize/deserialize cycles) as
> well ?
>
> 2. I am assuming activate() is called in these scenarios ? - The javadoc
> for activation states that the activate() can be called multiple times (
> without explicitly stating why ) and my assumption is that it is because of
> these scenarios.
>
> 3. If setup() is only called once during the lifetime of an operator , is
> it fair to assume that activate() is the best place to resolve all of the
> transient fields of an operator ?
>
>
> Regards,
> Ananth

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message