apex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chetan Narsude <che...@datatorrent.com>
Subject Re: Operator Initialization methods.
Date Mon, 21 Sep 2015 05:47:31 GMT
The order using regular expression like syntax:

setup activate (begin window (process)* end window)* deactivate teardown

Initially, I had coded it with the idea that an operator can be
activated/deactivated multiple times during the lifetime of the operator
while setup and teardown will be called exactly once. So far the
implementation has not necessitated use of activate/deactivate more than
once during the lifetime of any operator. So activate/deactivate also
happens exactly once.

The time between setup and beginWindow is unpredictable but typically is
larger than that between activate and beginWindow. So I recommend that if
you want to acquire resources e.g. connecting to high throughput stream, do
it in activate (right before the first beginWindow) instead of setup.

And even case of exceptions - if setup returned successfully, teardown is
called. if activate was called, deactivate is also called. in case of error
- the container is killed abruptly so no such provision exists.



On Sun, Sep 20, 2015 at 10:06 PM, Tushar Gosavi <tushar@datatorrent.com>

> If my operator implements ActivationListener then what is the order of
> following calls.
> setup, teardown, activate, deactivate
> and when they are called?
> In which scenario it is preferable to use ActivationListerner instead of
> using setup and teardown?
> also If my operator throws an exception during any of beginWindow, process
> and endWindow method, will teardown/deactive will get call on it?
> - Tushar.

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