- From: <adam.b.feldman AT rutgers.edu>
- To: graphstream-users AT litislab.fr
- Subject: Synchronization and multiple threads
- Date: Wed, 8 Aug 2012 17:16:29 +0200 (CEST)
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.
- Synchronization and multiple threads, adam.b.feldman, 08/08/2012
Archives gérées par MHonArc 2.6.16.