OSGi Threading Model

后端 未结 4 1188
独厮守ぢ
独厮守ぢ 2021-02-14 15:13

I have searched the Internet but failed to find a satisfactory answer. What is the threading model present in an OSGi container? Does it simply spawn a new thread to each regist

4条回答
  •  遥遥无期
    2021-02-14 15:56

    When you start a bundle, code in activator is executed in one thread, similar to the 'main' thread. When the main thread completes its execution, bundle is changed from the 'Starting' state to 'Active' state. So it is better to execute time consuming code in another thread and starting another thread from the main thread.

    When service method gets called from service consumer. At that time, the code written in the service method get executed in service consumer's thread.

    I didn't find any difference between static variables and local variable in the service method.

提交回复
热议问题