GraphStream Users

Archives de la liste Aide


Re: Avoid concurrency issues when setting node attributes


Chronologique Discussions 
  • From: Stefan Balev <stefan.balev AT gmail.com>
  • To: graphstream-users AT litislab.fr, daniele visaggio <visaggio.daniele AT gmail.com>
  • Subject: Re: Avoid concurrency issues when setting node attributes
  • Date: Sun, 13 Jan 2013 13:37:42 +0100

Hi Daniele,

In all current implementations, each Node keeps its attributes in its own HashMap<String, Object>. As long as there is a single thread processing each node, manipulating attributes should not cause any concurrency issues.

Best,

--
Stefan


2013/1/13 daniele visaggio <visaggio.daniele AT gmail.com>
Hi list,

I need to set nodes' attributes from a number of concurring threads.

Each thread owns a node object. Node objects are chosen by each thread at random from a LinkedBlockingQueue. No more than one thread can choose the same node, since we delete an already chosen node from LinkedBlockingQueue in an atomic way.

Now I need to perform a node.setAttribute() from each thread.

Is this a thread-safe operation in your opinion? or do I need to synchronize each setAttribute() in some way?

Thank you in advance,

Best Regards - Daniele




Archives gérées par MHonArc 2.6.16.

Top of page