World Wind Forums

Go Back   World Wind Forums > WorldWind JAVA forums > Development Help

Development Help Help for building applications or diagnosing problems with WWJ

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 10-27-2010, 03:16 AM   #1
Unregistered
Guest
 
Posts: n/a
Default Exception encountered while repainting Polyline

How do I prevent a ConcurrentModificationException while rendering a polyline?

I have an ArrayDeque of 25 positionObjects in a thread that sleeps on a 500ms interval. This is the run method:

public synchronized void run() {
historyLayer.addRenderable(polyline);
boolean layerAdded = true;

Object lock = new Object();
while (!stopped) {

if (!positionObjects.isEmpty()) {
//NOTE: WWJ polyline class is throwing concurrent modification exception
synchronized (lock) {
polyline.setPositions(positionObjects);

}
}
//if not viewing the history, remove it from screen
if (!displaying) {
historyLayer.removeRenderable(polyline);
layerAdded = false;
}
// only add one polyline to the historyLayer
else if(!layerAdded) {
historyLayer.addRenderable(polyline);
layerAdded = true;
}

}

Oct 26, 2010 8:39:12 PM gov.nasa.worldwind.AbstractSceneControll er draw
SEVERE: Exception encountered while repainting
java.util.ConcurrentModificationExceptio n
at java.util.AbstractList$Itr.checkForComod ification(AbstractList.java:372)
at java.util.AbstractList$Itr.next(Abstract List.java:343)
at gov.nasa.worldwind.render.Polyline.drawO rderedRenderable(Unknown Source)
at gov.nasa.worldwind.render.Polyline.draw( Unknown Source)
at gov.nasa.worldwind.render.Polyline.rende r(Unknown Source)
at gov.nasa.worldwind.AbstractSceneControll er.draw(Unknown Source)
at gov.nasa.worldwind.BasicSceneController. doRepaint(Unknown Source)
at gov.nasa.worldwind.AbstractSceneControll er.repaint(Unknown Source)
at gov.nasa.worldwind.WorldWindowGLAutoDraw able.doDisplay(Unknown Source)
at gov.nasa.worldwind.WorldWindowGLAutoDraw able.display(Unknown Source)
at com.sun.opengl.impl.GLDrawableHelper.dis play(GLDrawableHelper.java:78)
at javax.media.opengl.GLCanvas$DisplayActio n.run(GLCanvas.java:435)
at com.sun.opengl.impl.GLDrawableHelper.inv okeGL(GLDrawableHelper.java:194)
at javax.media.opengl.GLCanvas.maybeDoSingl eThreadedWorkaround(GLCanvas.java:412)
at javax.media.opengl.GLCanvas.display(GLCa nvas.java:244)
at javax.media.opengl.GLCanvas.paint(GLCanv as.java:277)
at javax.media.opengl.GLCanvas.update(GLCan vas.java:354)
at sun.awt.RepaintArea.updateComponent(Repa intArea.java:239)
at sun.awt.RepaintArea.paint(RepaintArea.ja va:216)
at sun.awt.windows.WComponentPeer.handleEve nt(WComponentPeer.java:306)
at java.awt.Component.dispatchEventImpl(Com ponent.java:4706)
at java.awt.Component.dispatchEvent(Compone nt.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQ ueue.java:599)
at java.awt.EventDispatchThread.pumpOneEven tForFilters(EventDispatchThread.java:269 )
at java.awt.EventDispatchThread.pumpEventsF orFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsF orHierarchy(EventDispatchThread.java:174 )
at java.awt.EventDispatchThread.pumpEvents( EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents( EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDi spatchThread.java:122)
  Reply With Quote
 

Tags
None


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Polyline render exception King0liver Development Help 5 05-13-2010 07:43 PM
Capabilities.retrieve() throws an exception, which I cannot catch. timeless Development Help 2 12-08-2009 06:56 AM
Exception handling help (newbie) Unregistered Development Help 3 12-30-2008 02:47 PM
OutOfMemoryError using Polyline tmorrison Development Help 11 01-29-2008 09:42 AM
SEVERE: Exception encountered while repainting, No Such Method Shaun Development Help 5 01-07-2008 04:51 PM


All times are GMT +1. The time now is 07:21 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.