File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 25
25
import org .bson .io .*;
26
26
27
27
class Response {
28
-
28
+
29
29
Response ( DBCollection collection , InputStream in )
30
30
throws IOException {
31
-
32
31
_collection = collection ;
33
32
_raw = in ;
34
33
@@ -63,7 +62,12 @@ class Response {
63
62
}
64
63
65
64
void addHook ( DoneHook h ){
66
- _hooks .add ( h );
65
+ if ( _user ._toGo == 0 ){
66
+ h .done ();
67
+ }
68
+ else {
69
+ _hooks .add ( h );
70
+ }
67
71
}
68
72
69
73
boolean more (){
@@ -119,7 +123,7 @@ public int read()
119
123
120
124
int val = _in .read ();
121
125
_toGo --;
122
-
126
+
123
127
if ( _toGo == 0 ){
124
128
for ( DoneHook h : _hooks )
125
129
h .done ();
@@ -159,7 +163,7 @@ public String toString(){
159
163
private DBObject _peek ;
160
164
private int _readSoFar ;
161
165
private List <DoneHook > _hooks = new LinkedList <DoneHook >();
162
-
166
+
163
167
static interface DoneHook {
164
168
void done ();
165
169
void error ( IOException ioe );
Original file line number Diff line number Diff line change 23
23
public abstract class SimplePool <T > {
24
24
25
25
static final boolean TRACK_LEAKS = Boolean .getBoolean ( "MONGO-TRACKLEAKS" );
26
- static long _sleepTime = 15 ;
26
+ static final long _sleepTime = 15 ;
27
27
28
28
/**
29
29
* See full constructor docs
You can’t perform that action at this time.
0 commit comments