Skip to content

Commit 3a05299

Browse files
author
Ryan
committed
changed so db callback can be changed.
1 parent 0c7fb3b commit 3a05299

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

src/main/com/mongodb/Response.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
import org.bson.io.*;
2626

2727
class Response {
28-
28+
2929
Response( ServerAddress addr , DBCollection collection , InputStream in, BSONDecoder decoder)
3030
throws IOException {
3131

3232
_host = addr;
33-
33+
3434
byte[] b = new byte[36];
3535
Bits.readFully(in, b);
3636

@@ -54,8 +54,8 @@ class Response {
5454
else
5555
_objects = new ArrayList<DBObject>( _num );
5656

57-
DBCallback c = DBCallback.FACTORY.create( collection );
58-
57+
DBCallback c = collection.getDB().getMongo().getMongoOptions().dbCallbackFactory.create( collection );
58+
5959
for ( int i=0; i<_num; i++ ){
6060
if ( user._toGo < 5 )
6161
throw new IOException( "should have more objects, but only " + user._toGo + " bytes left" );
@@ -74,54 +74,54 @@ class Response {
7474
public int size(){
7575
return _num;
7676
}
77-
77+
7878
public DBObject get( int i ){
7979
return _objects.get( i );
8080
}
8181

8282
public Iterator<DBObject> iterator(){
8383
return _objects.iterator();
8484
}
85-
85+
8686
public boolean hasGetMore( int queryOptions ){
8787
if ( _cursor == 0 )
8888
return false;
89-
89+
9090
if ( _num > 0 )
9191
return true;
9292

9393
if ( ( queryOptions & Bytes.QUERYOPTION_TAILABLE ) == 0 )
9494
return false;
95-
95+
9696
// have a tailable cursor
9797

9898
if ( ( _flags & Bytes.RESULTFLAG_AWAITCAPABLE ) > 0 && ( queryOptions & Bytes.QUERYOPTION_AWAITDATA ) > 0 )
9999
return true;
100-
100+
101101
try {
102102
Thread.sleep( 500 );
103103
}
104104
catch ( Exception e ){}
105-
105+
106106
return true;
107107
}
108-
108+
109109
public long cursor(){
110110
return _cursor;
111111
}
112112

113113
public ServerError getError(){
114114
if ( _num != 1 )
115115
return null;
116-
116+
117117
DBObject obj = get(0);
118-
118+
119119
if ( ServerError.getMsg( obj , null ) == null )
120120
return null;
121-
121+
122122
return new ServerError( obj );
123123
}
124-
124+
125125
static class MyInputStream extends InputStream {
126126
MyInputStream( InputStream in , int max ){
127127
_in = in;
@@ -138,10 +138,10 @@ public int read()
138138

139139
if ( _toGo <= 0 )
140140
return -1;
141-
141+
142142
int val = _in.read();
143143
_toGo--;
144-
144+
145145
return val;
146146
}
147147

@@ -174,12 +174,12 @@ public String toString(){
174174
final int _id;
175175
final int _responseTo;
176176
final int _operation;
177-
177+
178178
final int _flags;
179179
long _cursor;
180180
final int _startingFrom;
181181
final int _num;
182-
182+
183183
final List<DBObject> _objects;
184184

185185

0 commit comments

Comments
 (0)