Revision 5393 branches/MULTITHREADING_DEVELOPMENT/extensions/extWMS/src/com/iver/cit/gvsig/fmap/drivers/wms/ExperimentalAsynchronousFMapWMSDriver.java

View differences:

ExperimentalAsynchronousFMapWMSDriver.java
43 43
*
44 44
* $Id$
45 45
* $Log$
46
* Revision 1.1.2.2  2006-05-22 12:19:06  jaume
46
* Revision 1.1.2.3  2006-05-24 10:41:19  jaume
47 47
* *** empty log message ***
48 48
*
49
* Revision 1.1.2.2  2006/05/22 12:19:06  jaume
50
* *** empty log message ***
51
*
49 52
* Revision 1.1.2.1  2006/05/19 12:50:31  jaume
50 53
* *** empty log message ***
51 54
*
......
59 62

  
60 63
import org.gvsig.remoteClient.exceptions.ServerErrorException;
61 64
import org.gvsig.remoteClient.exceptions.WMSException;
65
import org.gvsig.remoteClient.taskplanning.ICancellable;
62 66
import org.gvsig.remoteClient.taskplanning.retrieving.RetrieveEvent;
63 67
import org.gvsig.remoteClient.wms.WMSEventListener;
64 68
import org.gvsig.remoteClient.wms.WMSStatus;
......
70 74
	private boolean done;
71 75
	private final long latency = 200; // milliseconds
72 76
	private String fileName;
77
	private ICancellable cancel;
78
	
73 79
	protected ExperimentalAsynchronousFMapWMSDriver(URL host) {
74 80
		super(host);
75
		// TODO Auto-generated constructor stub
76 81
	}
77 82

  
78 83
	public void run() {
79
		try {
80
			client.getMap(status);
81
			while (!done) {
84
		// try {
85
			client.getMap(status, cancel);
86
			/* while (!done) {
82 87
				Thread.sleep(latency);
83
			}
84
		} catch (WMSException e) {
85
			// TODO Auto-generated catch block
86
			e.printStackTrace();
87
		} catch (ServerErrorException e) {
88
			// TODO Auto-generated catch block
89
			e.printStackTrace();
90
		} catch (InterruptedException e) {
91
			// TODO Auto-generated catch block
92
			e.printStackTrace();
93
		}
88
			}*/
89
		/* } catch (InterruptedException e) {
90
			e.printStackTrace(); 
91
		}*/
94 92
	}
95 93

  
96 94
	public void newEvent(int idRequest, RetrieveEvent event) {
......
98 96
			if (event.getType() == WMSOperations.REQUEST_FINISHED) {
99 97
				done = true;
100 98
				fileName = event.getFileName();
101
			} else if (event.getType() == WMSOperations.REQUEST_FAILED) {
99
			} else if (event.getType() < 0) {
102 100
				System.err.println("something failed");
103 101
				done = true;
104 102
			}
......
110 108
	 *  (non-Javadoc)
111 109
	 * @see com.iver.cit.gvsig.fmap.drivers.WMSDriver#getMap(org.gvsig.remoteClient.wms.WMSStatus)
112 110
	 */
113
    public void getMap(WMSStatus status) {
111
    public void getMap(WMSStatus status, ICancellable cancel) {
114 112
    	done = false;
115 113
    	this.status = status;
116
        
114
        this.cancel = cancel;
117 115
    }
118 116

  
119 117
    public File getFile() {

Also available in: Unified diff