osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Singleton in a taskmanager


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<tchen325@xxxxxxxxxxxxx>
Recipient: user<user@xxxxxxxxxxxxxxxx>
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/