Revision 24420
branches/v2_0_0_prep/libraries/libFMap_data/src/org/gvsig/fmap/data/resource/spi/AbstractResource.java | ||
---|---|---|
49 | 49 |
import org.gvsig.fmap.data.resource.exception.ResourceNotifyDisposeException; |
50 | 50 |
import org.gvsig.fmap.data.resource.exception.ResourceNotifyOpenException; |
51 | 51 |
import org.gvsig.fmap.data.resource.impl.DefaultResourceNotification; |
52 |
import org.gvsig.tools.observer.Observer; |
|
52 | 53 |
import org.gvsig.tools.observer.WeakReferencingObservable; |
53 |
import org.gvsig.tools.observer.Observer; |
|
54 | 54 |
import org.gvsig.tools.observer.impl.BaseWeakReferencingObservable; |
55 | 55 |
import org.gvsig.tools.observer.impl.DelegateWeakReferencingObservable; |
56 | 56 |
|
... | ... | |
134 | 134 |
|
135 | 135 |
} |
136 | 136 |
|
137 |
public synchronized final void begin() throws ResourceBeginException { |
|
138 |
if (inUse) { |
|
139 |
try { |
|
140 |
semaforo.wait(); |
|
141 |
} catch (InterruptedException e) { |
|
142 |
throw new ResourceBeginException(this, e); |
|
137 |
public final void begin() throws ResourceBeginException { |
|
138 |
synchronized (semaforo) { |
|
139 |
if (inUse) { |
|
140 |
try { |
|
141 |
this.wait(); |
|
142 |
} catch (InterruptedException e) { |
|
143 |
throw new ResourceBeginException(this, e); |
|
144 |
} |
|
143 | 145 |
} |
146 |
inUse = true; |
|
147 |
updateLastTimeUsed(); |
|
148 |
|
|
144 | 149 |
} |
145 |
inUse = true; |
|
146 |
updateLastTimeUsed(); |
|
147 | 150 |
} |
148 | 151 |
|
149 |
public synchronized final void end() { |
|
150 |
if (!inUse) { |
|
151 |
return; |
|
152 |
public final void end() { |
|
153 |
synchronized (semaforo) { |
|
154 |
if (!inUse) { |
|
155 |
return; |
|
156 |
} |
|
157 |
updateLastTimeUsed(); |
|
158 |
inUse = false; |
|
159 |
semaforo.notifyAll(); |
|
152 | 160 |
} |
153 |
updateLastTimeUsed(); |
|
154 |
inUse = false; |
|
155 |
semaforo.notifyAll(); |
|
156 | 161 |
} |
157 | 162 |
|
158 | 163 |
public final boolean inUse() { |
Also available in: Unified diff