GraphStream Users

Archives de la liste Aide


Re: Synchronization and multiple threads


Chronologique Discussions 
  • From: guilhelm savin <guilhelm.savin AT gmail.com>
  • To: graphstream-users AT litislab.fr, adam.b.feldman AT rutgers.edu
  • Subject: Re: Synchronization and multiple threads
  • Date: Wed, 8 Aug 2012 18:46:41 +0200

Hi Adam,

As you have discovered, ConcurrentGraph has been removed and replaced
by the Graphs.synchronizedGraph(..) method.

The error you got is an issue. I just fix it. You can get the new jar
here : 


Thanks for your feedback. If you have any other error, don't hesitate
to contact us again.

Regards.

Guilhelm

2012/8/8 <adam.b.feldman AT rutgers.edu>
Firstly, I should mention that I just started using GraphStream(1.1.1) and it's
great, thanks for the amazing set of libraries!

I started off working in a single thread, and then realized I needed threading,
so I attempted to convert my code to something capable of handling threading. I
now have a thread that is pulling data from a stream and adding it to the
graph.  When I started threading program, I attempted to use the
ConcurrentGraph mentioned in the FAQ
(http://graphstream-project.org/doc/FAQ/The-Graph-Class/What-are-the-Graph-implementations_1.0/),
but I keep getting a "The import
org.graphstream.graph.implementations.ConcurrentGraph cannot be resolved"
error.   I did however find Graphs.synchronizedGraph(g).  With this, nodes add
without error, but edges, I've been gettting:
"
Exception in thread "Thread-0" java.lang.ClassCastException:
org.graphstream.graph.implementations.Graphs$SynchronizedNode cannot be cast to
org.graphstream.graph.implementations.AbstractNode
        at
org.graphstream.graph.implementations.AbstractGraph.addEdge(AbstractGraph.java:334)
        at
org.graphstream.graph.implementations.AbstractGraph.addEdge(AbstractGraph.java:329)
        at
org.graphstream.graph.implementations.Graphs$SynchronizedGraph.addEdge(Graphs.java:423)
"

My code at the point of this error is:
e=g.addEdge(id, n1, n2);

Any suggestions on how to resolve these issues?  Thanks in advance.



--
Guilhelm Savin
PhD Student of Computer Science




Archives gérées par MHonArc 2.6.16.

Top of page