Singleton in a taskmanager

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Singleton in a taskmanager

burgesschen
Hi Guys,

I am running into a problem.

I have 2 jobs running on the same taskmanager. Each Job creates a singleton
of the same class, say MySingleton class. Are they actually sharing the same
singleton?

Hope my question is clear.

Best,
Burgess Chen



--
Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Singleton in a taskmanager

bupt_ljy

Hi Chen,

    They will not be sharing the same singleton. Firstly, the class is referenced by its classloader. And the classloader is bound to task. Therefore, different job’s slots have different classloaders, which means the different task’s class's references are different.

    Please correct me if I’m wrong.


Best,

Jiayi Liao


 Original Message 
Sender: burgesschen<[hidden email]>
Recipient: user<[hidden email]>
Date: Wednesday, Dec 12, 2018 08:10
Subject: Singleton in a taskmanager

Hi Guys,

I am running into a problem. 

I have 2 jobs running on the same taskmanager. Each Job creates a singleton
of the same class, say MySingleton class. Are they actually sharing the same
singleton?

Hope my question is clear.

Best,
Burgess Chen



--
Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/