- Timestamp:
- 2017-05-01T18:23:39+12:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/gui/CreatePane.java
r29711 r31638 156 156 public String homepage = null; 157 157 158 /** Access to the GShell object that this CreatePane listens to events for. 159 * A handle to the GShell is needed order to interrupt any processes the GShell runs 160 * when the user cancels a build operation. 161 */ 162 private GShell shell = null; 163 158 164 /** The constructor creates important helper classes, and initializes all the components. 159 165 * @see org.greenstone.gatherer.collection.CollectionManager … … 291 297 } 292 298 299 public void setGShell(GShell shell) { 300 this.shell = shell; 301 } 293 302 294 303 public void destroy() { … … 840 849 private class CancelButtonListener 841 850 implements ActionListener { 842 /** This method attempts to cancel the current GShell task. It does this by first telling CollectionManager not to carry out any further action. This it turn tells the GShell to break from the current job immediately, without waiting for the processEnded message, and then kills the thread in an attempt to stop the process. The results of such an action are debatable. 851 /** This method attempts to cancel the current GShell task. It does this by first telling CollectionManager not to carry out any further action. 852 * Previously, this would in turn tell the GShell to break from the current job immediately, without waiting for the processEnded message, and then kills the thread in an attempt to stop the process. The results of such an action are debatable. 853 * Now, pressing cancel will send an interrupt to the GShell thread, which is the thread in which the external process is run (via the SafeProcess object). Interrupting a running SafeProcess will then interrupt any worker threads and destroy the process, with SafeProcess cleaning up after itself after its worker threads finished cleaning up after themselves. Tested on Linux. 843 854 * @param event An <strong>ActionEvent</strong> who, thanks to the power of object oriented programming, we don't give two hoots about. 844 855 * @see org.greenstone.gatherer.Gatherer … … 867 878 build_monitor.setStop(true); 868 879 build_monitor.reset(); 880 // Tell the GShell to cleanly stop running its external process 881 if(CreatePane.this.shell != null) { 882 // We can call GShell.cancel() even if the GShell thread is blocking when running a process, 883 // because this CreatePane is running in its own separate GUI thread. This is because the 884 // process blocking call (process.waitFor()) and cancel() are not sequential operations. 885 CreatePane.this.shell.cancel(); 886 } 869 887 870 888 // Remove the collection lock.
Note:
See TracChangeset
for help on using the changeset viewer.