Revision 5269 branches/MULTITHREADING_DEVELOPMENT/libraries/libRemoteServices/src/org/gvsig/remoteClient/taskplanning/retrieving/URLRetrieveTask.java

View differences:

URLRetrieveTask.java
73 73
			
74 74
			if (cancelled) {
75 75
				// Bad incomplete file, delete it.
76
				System.out.println("download cancelled ("+url+")");
76
				System.out.println("\n[RemoteClients:URLRetrieveTask] download cancelled ("+url+")\n");
77 77
				f.delete();
78 78
			}
79 79
			
......
88 88
			request.setStatus(RetrieveEvent.REQUEST_FAILED);
89 89
		} catch (IOException e) {
90 90
			e.printStackTrace();
91
			request.setStatus(RetrieveEvent.REQUEST_FAILED);
91
			if (!cancelled)
92
				request.setStatus(RetrieveEvent.REQUEST_FAILED);
92 93
		}
93 94
	}
94 95

  
95 96
	public void cancel() {
96
		cancelled = true;
97 97
		try {
98
			if (is != null) {
99
				is.close();
100
				is = null;
98
			synchronized (this) {
99
				if (is != null) {
100
					is.close();
101
					is = null;
102
				}
101 103
			}
102 104
		} catch (IOException e) {
103 105
			e.printStackTrace();
104 106
		}
107
		cancelled = true;
105 108
	}
106 109

  
107 110
	public boolean isRunning() {

Also available in: Unified diff