35
35
* @author antoine
36
36
*/
37
37
public class Bytes extends BSON {
38
-
38
+
39
39
static final Logger LOGGER = Logger .getLogger ( "com.mongodb" );
40
-
40
+
41
41
static final boolean D = Boolean .getBoolean ( "DEBUG.MONGO" );
42
42
43
43
static {
@@ -57,7 +57,7 @@ public class Bytes extends BSON {
57
57
58
58
/** default target size of an insert batch */
59
59
static final int BATCH_INSERT_SIZE = 1024 * 1024 * 8 ;
60
-
60
+
61
61
static final int CONNECTIONS_PER_HOST = Integer .parseInt ( System .getProperty ( "MONGO.POOLSIZE" , "10" ) );
62
62
63
63
@@ -83,22 +83,22 @@ public class Bytes extends BSON {
83
83
* Set this option to prevent that.
84
84
*/
85
85
public static final int QUERYOPTION_NOTIMEOUT = 1 << 4 ;
86
-
86
+
87
87
/**
88
88
* Use with TailableCursor.
89
89
* If we are at the end of the data, block for a while rather than returning no data.
90
90
* After a timeout period, we do return as normal.
91
91
*/
92
92
public static final int QUERYOPTION_AWAITDATA = 1 << 5 ;
93
-
93
+
94
94
/**
95
95
* Stream the data down full blast in multiple "more" packages, on the assumption that the client will fully read all data queried.
96
96
* Faster when you are pulling a lot of data and know you want to pull it all down.
97
97
* Note: the client is not allowed to not read all the data unless it closes the connection.
98
98
*/
99
99
public static final int QUERYOPTION_EXHAUST = 1 << 6 ;
100
100
101
- /**
101
+ /**
102
102
* Use with sharding (mongos).
103
103
* Allows partial results from a sharded system if any shards are down/missing from the cluster. If not used an error will be returned
104
104
* from the mongos server.
@@ -107,7 +107,7 @@ public class Bytes extends BSON {
107
107
108
108
/**
109
109
* Set when getMore is called but the cursor id is not valid at the server.
110
- * Returned with zero results.
110
+ * Returned with zero results.
111
111
*/
112
112
public static final int RESULTFLAG_CURSORNOTFOUND = 1 ;
113
113
/**
@@ -137,15 +137,15 @@ void set( int options ){
137
137
_options = options ;
138
138
_hasOptions = true ;
139
139
}
140
-
140
+
141
141
int get (){
142
142
if ( _hasOptions )
143
143
return _options ;
144
144
if ( _parent == null )
145
145
return 0 ;
146
146
return _parent .get ();
147
147
}
148
-
148
+
149
149
void add ( int option ){
150
150
set ( get () | option );
151
151
}
@@ -155,7 +155,7 @@ void reset(){
155
155
}
156
156
157
157
final OptionHolder _parent ;
158
-
158
+
159
159
int _options = 0 ;
160
160
boolean _hasOptions = false ;
161
161
}
@@ -179,17 +179,17 @@ public static byte getType( Object o ){
179
179
|| o instanceof AtomicInteger ) {
180
180
return NUMBER_INT ;
181
181
}
182
-
182
+
183
183
if (o instanceof Long || o instanceof AtomicLong ) {
184
184
return NUMBER_LONG ;
185
185
}
186
186
187
187
if ( o instanceof Number )
188
188
return NUMBER ;
189
-
189
+
190
190
if ( o instanceof String )
191
191
return STRING ;
192
-
192
+
193
193
if ( o instanceof java .util .List )
194
194
return ARRAY ;
195
195
@@ -198,10 +198,10 @@ public static byte getType( Object o ){
198
198
199
199
if ( o instanceof ObjectId )
200
200
return OID ;
201
-
201
+
202
202
if ( o instanceof Boolean )
203
203
return BOOLEAN ;
204
-
204
+
205
205
if ( o instanceof java .util .Date )
206
206
return DATE ;
207
207
@@ -210,13 +210,13 @@ public static byte getType( Object o ){
210
210
211
211
if ( o instanceof java .util .regex .Pattern )
212
212
return REGEX ;
213
-
213
+
214
214
if ( o instanceof DBObject || o instanceof DBRefBase )
215
215
return OBJECT ;
216
216
217
217
if ( o instanceof Code )
218
218
return CODE ;
219
-
219
+
220
220
if ( o instanceof CodeWScope )
221
221
return CODE_W_SCOPE ;
222
222
0 commit comments