1

I'm writing an applicaton that uses JMapViewer. There are several threads (executed in a ThreadPoolExecutor) which acts over the displayed map (mainly creating/destroying and changing the color of some MapMarkerCircle). Does this violate the Single Thread Rule? Should I run the code which acts over the map in the done() method of a SwingWorker to make sure it will be executed in the Event Dispatch Thread?

Thanks.

4

1 回答 1

2

由于标记等的 setter 函数 on JMapViewercall repaint(),因此您需要确保仅在事件调度线程上调用它们。repaint()被记录为不是线程安全的,尽管它当前可能正常工作。

于 2015-05-28T14:58:59.157 回答