* delayed creation of TerrainQuad executorService unless absolutely needed
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7823 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
b2c7849355
commit
9407f4c3d0
@ -105,16 +105,18 @@ public class TerrainQuad extends Node implements Terrain {
|
|||||||
|
|
||||||
private TerrainPicker picker;
|
private TerrainPicker picker;
|
||||||
|
|
||||||
|
protected ExecutorService executor;
|
||||||
|
|
||||||
protected ExecutorService executor = Executors.newSingleThreadExecutor(new ThreadFactory() {
|
protected ExecutorService createExecutorService() {
|
||||||
public Thread newThread(Runnable r) {
|
return Executors.newSingleThreadExecutor(new ThreadFactory() {
|
||||||
Thread th = new Thread(r);
|
public Thread newThread(Runnable r) {
|
||||||
th.setName("jME Terrain Thread");
|
Thread th = new Thread(r);
|
||||||
th.setDaemon(true);
|
th.setName("jME Terrain Thread");
|
||||||
return th;
|
th.setDaemon(true);
|
||||||
}
|
return th;
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public TerrainQuad() {
|
public TerrainQuad() {
|
||||||
super("Terrain");
|
super("Terrain");
|
||||||
@ -229,6 +231,9 @@ public class TerrainQuad extends Node implements Terrain {
|
|||||||
return; // we just want the root quad to perform this.
|
return; // we just want the root quad to perform this.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (executor == null)
|
||||||
|
executor = createExecutorService();
|
||||||
|
|
||||||
UpdateLOD updateLodThread = new UpdateLOD(locations);
|
UpdateLOD updateLodThread = new UpdateLOD(locations);
|
||||||
executor.execute(updateLodThread);
|
executor.execute(updateLodThread);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user