Till Rohrmann created FLINK-11718:
-------------------------------------

             Summary: Add onStart method to RpcEndpoint which is run in the 
actor's main thread
                 Key: FLINK-11718
                 URL: https://issues.apache.org/jira/browse/FLINK-11718
             Project: Flink
          Issue Type: Improvement
          Components: Distributed Coordination
    Affects Versions: 1.8.0
            Reporter: Till Rohrmann
            Assignee: Till Rohrmann


I propose to introduce a {{RpcEndpoint#onStart}} method which is called when 
the {{RpcEndpoint}} is started via {{RpcEndpoint#start}}. At the moment, users 
will override {{#start}} where they need to remember to also call 
{{super.start()}} in order to actually start the {{RpcEndpoint}}. Moreover, the 
logic executed by {{start}} won't be run in the actor's main thread. This is 
problematic if the method triggers asynchronous behaviour which is executed in 
the actor's main thread. If that is the case, it can happen that the 
asynchronous operation is executed before the {{start}} method has been 
finished. 

Due to these problems, I suggest to introduce a {{RpcEndpoint#onStart}} method 
which can be overriden by sub classes similarly to the {{RpcEndpoint#onStop}} 
method. The {{onStart}} method can be used to setup the {{RpcEndpoint}} and is 
guaranteed to be executed before any other message is processed.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to