34 |
|
* if (currentBuffer.full()) |
35 |
|
* currentBuffer = exchanger.exchange(currentBuffer); |
36 |
|
* } |
37 |
< |
* } |
38 |
< |
* catch (InterruptedException ex) { ... handle ... } |
37 |
> |
* } catch (InterruptedException ex) { ... handle ... } |
38 |
|
* } |
39 |
|
* } |
40 |
|
* |
47 |
|
* if (currentBuffer.empty()) |
48 |
|
* currentBuffer = exchanger.exchange(currentBuffer); |
49 |
|
* } |
50 |
< |
* } |
52 |
< |
* catch (InterruptedException ex) { ... handle ...} |
50 |
> |
* } catch (InterruptedException ex) { ... handle ...} |
51 |
|
* } |
52 |
|
* } |
53 |
|
* |
122 |
|
else |
123 |
|
break; // timed out |
124 |
|
} |
125 |
< |
} |
128 |
< |
catch (InterruptedException ie) { |
125 |
> |
} catch (InterruptedException ie) { |
126 |
|
interrupted = ie; |
127 |
|
} |
128 |
|
|
147 |
|
throw interrupted; |
148 |
|
else // must be timeout |
149 |
|
throw new TimeoutException(); |
150 |
< |
} |
154 |
< |
finally { |
150 |
> |
} finally { |
151 |
|
lock.unlock(); |
152 |
|
} |
153 |
|
} |
192 |
|
public V exchange(V x) throws InterruptedException { |
193 |
|
try { |
194 |
|
return doExchange(x, false, 0); |
195 |
< |
} |
200 |
< |
catch (TimeoutException cannotHappen) { |
195 |
> |
} catch (TimeoutException cannotHappen) { |
196 |
|
throw new Error(cannotHappen); |
197 |
|
} |
198 |
|
} |