Changeset 8589
- Timestamp:
- 2004-11-17T13:34:59+13:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java
r8588 r8589 101 101 private GShellProgressMonitor import_monitor = null; 102 102 103 /** Holds a reference to the thread responsible for closing the collection. If non-null then only calls from the given thread will see the collection is non-ready. All other threads will have to wait until closing thread, and all of it consequential calls, are completely finished. */104 private Thread closing_thread = null;105 106 103 /** The name of the standard lock file. */ 107 104 static final public String LOCK_FILE = "gli.lck"; … … 215 212 public void closeCollection() { 216 213 DebugStream.println("Close collection: " + collection.getName()); 217 // We set the closing thread, as it should be the only one who can actually see the collection is closed, at least until the closing thread expires. 218 closing_thread = Thread.currentThread(); 214 219 215 // Remove the lock on this file, then remove the collection. 220 216 String collection_dir; … … 244 240 Gatherer.g_man.refresh(COLLECTION_CLOSED, false); 245 241 } 246 // All of the consequences of a close should have been processed by now, so others should now see the collection as non-ready.247 closing_thread = null;248 242 } 249 243 … … 1180 1174 } 1181 1175 } 1176 1177 1182 1178 /** Determine if the manager is ready for actions apon its collection. 1183 1179 * @return A <i>boolean</i> which is <i>true</i> to indicate a collection has been loaded and thus the collection is ready for editing, <i>false</i> otherwise. … … 1192 1188 } 1193 1189 1194 public synchronized boolean reallyReady() {1195 // If the closing thread is non-null we should only allow that thread to see the collection as closed.1196 if(closing_thread != null) {1197 // Only the closing thread sees the truth1198 if(Thread.currentThread() == closing_thread) {1199 return (collection == null);1200 }1201 // All other threads are told a lie.1202 else {1203 return true;1204 }1205 }1206 else {1207 if(collection != null) {1208 return true;1209 }1210 else {1211 return false;1212 }1213 }1214 }1215 1190 1216 1191 /** This method associates the collection build monitor with the build monitor created in CreatePane.
Note:
See TracChangeset
for help on using the changeset viewer.