corba/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerReadStream.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright 2000-2003 Sun Microsystems, Inc. All Rights Reserved. |
2 * Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Sun designates this |
7 * published by the Free Software Foundation. Sun designates this |
42 private int cancelReqId = 0; |
42 private int cancelReqId = 0; |
43 |
43 |
44 // We should convert endOfStream to a final static dummy end node |
44 // We should convert endOfStream to a final static dummy end node |
45 private boolean endOfStream = true; |
45 private boolean endOfStream = true; |
46 private BufferQueue fragmentQueue = new BufferQueue(); |
46 private BufferQueue fragmentQueue = new BufferQueue(); |
|
47 private long FRAGMENT_TIMEOUT = 60000; |
47 |
48 |
48 // REVISIT - This should go in BufferManagerRead. But, since |
49 // REVISIT - This should go in BufferManagerRead. But, since |
49 // BufferManagerRead is an interface. BufferManagerRead |
50 // BufferManagerRead is an interface. BufferManagerRead |
50 // might ought to be an abstract class instead of an |
51 // might ought to be an abstract class instead of an |
51 // interface. |
52 // interface. |
109 |
110 |
110 if (endOfStream) { |
111 if (endOfStream) { |
111 throw wrapper.endOfStream() ; |
112 throw wrapper.endOfStream() ; |
112 } |
113 } |
113 |
114 |
|
115 boolean interrupted = false; |
114 try { |
116 try { |
115 fragmentQueue.wait(); |
117 fragmentQueue.wait(FRAGMENT_TIMEOUT); |
116 } catch (InterruptedException e) {} |
118 } catch (InterruptedException e) { |
|
119 interrupted = true; |
|
120 } |
|
121 |
|
122 if (!interrupted && fragmentQueue.size() == 0) { |
|
123 throw wrapper.bufferReadManagerTimeout(); |
|
124 } |
117 |
125 |
118 if (receivedCancel) { |
126 if (receivedCancel) { |
119 throw new RequestCanceledException(cancelReqId); |
127 throw new RequestCanceledException(cancelReqId); |
120 } |
128 } |
121 } |
129 } |