Changeset 19231 in osm for applications/viewer/jmapviewer/src/org/openstreetmap
- Timestamp:
- 2009-12-28T13:30:18+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JobDispatcher.java
r18772 r19231 18 18 public class JobDispatcher { 19 19 20 private static JobDispatcher instance;20 private static final JobDispatcher instance = new JobDispatcher(); 21 21 22 22 /** … … 24 24 */ 25 25 public static JobDispatcher getInstance() { 26 // for speed reasons we check if the instance has been created 27 // one time before we enter the synchronized section... 28 if (instance != null) 29 return instance; 30 synchronized (JobDispatcher.class) { 31 // ... and for thread safety reasons one time inside the 32 // synchronized section. 33 if (instance != null) 34 return instance; 35 new JobDispatcher(); 36 return instance; 37 } 26 return instance; 38 27 } 39 28 40 29 private JobDispatcher() { 41 instance = this;42 30 addWorkerThread().firstThread = true; 43 31 } … … 91 79 workerThreadCount++; 92 80 } 81 jobThread.start(); 93 82 return jobThread; 94 83 } … … 103 92 setDaemon(true); 104 93 job = null; 105 start();106 94 } 107 95
Note:
See TracChangeset
for help on using the changeset viewer.