incubator-s4-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthieu Morel <matth...@yahoo-inc.com>
Subject Re: close method in ProcessingElement
Date Mon, 06 May 2013 10:05:07 GMT

On May 5, 2013, at 20:33 , Arinto Murdopo wrote:

Hi Matthieu,

I'm trying to understand some existing S4 code. So, that means, by calling the close() method,
the PE instances are still alive, just that the resources that allocated to the instances
are freed up. Are my statements correct?

Actually, the PE instance is removed from the cache, so it actually disappears from the system.
It's possible to add a hook on either cache invalidation or in the onRemove() method to checkpoint
before this happens.

In any case, if a new event comes and that it targets this PE,  a new instance will be created
if none is found in the cache. Either recovering previous state, if checkpointed, or with
a fresh state.



What are the normal use case for this close method to be invoked? And, what is "poison" event?

It's really a convenience method for PEs to decide to be removed from the system. Based on
some condition or some specific message that is received, e.g. a "poison" message. Note that
there is no delivery guarantee in case of failure in S4 so that should be taken into account.

Hope this helps,

Matthieu



regards,


Arinto
www.otnira.com<http://www.otnira.com/>


On Sun, May 5, 2013 at 2:48 PM, Matthieu Morel <matthieu@yahoo-inc.com<mailto:matthieu@yahoo-inc.com>>
wrote:
Hi Arinto,

that method is for properly cleaning up a PE instance. It could be used to release resources
that may be allocated within PE instances, and it could be triggered by some special event
(some kind of "poison" event), or some other condition.

It can be called from user code and custom behavior for releasing resources can be specified
in "onRemove()" method.

Do you have a specific usage in mind?

Matthieu


On May 4, 2013, at 17:17 , Arinto Murdopo wrote:

Hi all,

What does close() method means in org.apache.s4.core.ProcessingElement class?

The documentation<https://people.apache.org/~mmorel/apache-s4-0.6.0-incubating-doc/javadoc/org/apache/s4/core/ProcessingElement.html#close%28%29>
says nothing regarding this method.

best regards,

Arinto
www.otnira.com<http://www.otnira.com/>




Mime
View raw message