* delayed creation of TerrainQuad executorService unless absolutely needed

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7823 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
bre..ns 14 years ago
parent b2c7849355
commit 9407f4c3d0
  1. 25
      engine/src/terrain/com/jme3/terrain/geomipmap/TerrainQuad.java

@ -105,16 +105,18 @@ public class TerrainQuad extends Node implements Terrain {
private TerrainPicker picker;
protected ExecutorService executor = Executors.newSingleThreadExecutor(new ThreadFactory() {
public Thread newThread(Runnable r) {
Thread th = new Thread(r);
th.setName("jME Terrain Thread");
th.setDaemon(true);
return th;
}
});
protected ExecutorService executor;
protected ExecutorService createExecutorService() {
return Executors.newSingleThreadExecutor(new ThreadFactory() {
public Thread newThread(Runnable r) {
Thread th = new Thread(r);
th.setName("jME Terrain Thread");
th.setDaemon(true);
return th;
}
});
}
public TerrainQuad() {
super("Terrain");
@ -229,6 +231,9 @@ public class TerrainQuad extends Node implements Terrain {
return; // we just want the root quad to perform this.
}
if (executor == null)
executor = createExecutorService();
UpdateLOD updateLodThread = new UpdateLOD(locations);
executor.execute(updateLodThread);
}

Loading…
Cancel
Save