Skip to content

Commit 3f8b412

Browse files
author
Ankit Gupta
committed
Fix formatting
1 parent e96e71b commit 3f8b412

File tree

3 files changed

+37
-37
lines changed

3 files changed

+37
-37
lines changed

java/org/rocksdb/RocksDB.java

+19-19
Original file line numberDiff line numberDiff line change
@@ -154,58 +154,58 @@ public byte[] get(byte[] key) throws RocksDBException {
154154
public byte[] get(ReadOptions opt, byte[] key) throws RocksDBException {
155155
return get(nativeHandle_, opt.nativeHandle_, key, key.length);
156156
}
157-
157+
158158
/**
159159
* Returns a map of keys for which values were found in DB.
160-
*
160+
*
161161
* @param keys List of keys for which values need to be retrieved.
162-
* @return Map where key of map is the key passed by user and value for map
162+
* @return Map where key of map is the key passed by user and value for map
163163
* entry is the corresponding value in DB.
164-
*
165-
* @see RocksDBException
164+
*
165+
* @see RocksDBException
166166
*/
167167
public Map<byte[], byte[]> multiGet(List<byte[]> keys)
168168
throws RocksDBException {
169169
List<byte[]> values = multiGet(
170170
nativeHandle_, keys, keys.size());
171-
172-
Map<byte[], byte[]> keyValueMap = new HashMap<byte[], byte[]>();
171+
172+
Map<byte[], byte[]> keyValueMap = new HashMap<byte[], byte[]>();
173173
for(int i = 0; i < values.size(); i++) {
174174
if(values.get(i) == null) {
175175
continue;
176176
}
177-
177+
178178
keyValueMap.put(keys.get(i), values.get(i));
179179
}
180-
180+
181181
return keyValueMap;
182182
}
183-
184-
183+
184+
185185
/**
186186
* Returns a map of keys for which values were found in DB.
187-
*
187+
*
188188
* @param List of keys for which values need to be retrieved.
189189
* @param opt Read options.
190-
* @return Map where key of map is the key passed by user and value for map
190+
* @return Map where key of map is the key passed by user and value for map
191191
* entry is the corresponding value in DB.
192-
*
193-
* @see RocksDBException
192+
*
193+
* @see RocksDBException
194194
*/
195195
public Map<byte[], byte[]> multiGet(ReadOptions opt, List<byte[]> keys)
196196
throws RocksDBException {
197197
List<byte[]> values = multiGet(
198198
nativeHandle_, opt.nativeHandle_, keys, keys.size());
199-
200-
Map<byte[], byte[]> keyValueMap = new HashMap<byte[], byte[]>();
199+
200+
Map<byte[], byte[]> keyValueMap = new HashMap<byte[], byte[]>();
201201
for(int i = 0; i < values.size(); i++) {
202202
if(values.get(i) == null) {
203203
continue;
204204
}
205-
205+
206206
keyValueMap.put(keys.get(i), values.get(i));
207207
}
208-
208+
209209
return keyValueMap;
210210
}
211211

java/rocksjni/portal.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ class ListJni {
324324
assert(jclazz != nullptr);
325325
return jclazz;
326326
}
327-
327+
328328
// Get the java class id of java.util.ArrayList.
329329
static jclass getArrayListClass(JNIEnv* env) {
330330
static jclass jclazz = env->FindClass("java/util/ArrayList");
@@ -338,39 +338,39 @@ class ListJni {
338338
assert(jclazz != nullptr);
339339
return jclazz;
340340
}
341-
341+
342342
// Get the java method id of java.util.List.iterator().
343343
static jmethodID getIteratorMethod(JNIEnv* env) {
344344
static jmethodID mid = env->GetMethodID(
345345
getListClass(env), "iterator", "()Ljava/util/Iterator;");
346346
assert(mid != nullptr);
347347
return mid;
348348
}
349-
349+
350350
// Get the java method id of java.util.Iterator.hasNext().
351351
static jmethodID getHasNextMethod(JNIEnv* env) {
352352
static jmethodID mid = env->GetMethodID(
353353
getIteratorClass(env), "hasNext", "()Z");
354354
assert(mid != nullptr);
355355
return mid;
356356
}
357-
357+
358358
// Get the java method id of java.util.Iterator.next().
359359
static jmethodID getNextMethod(JNIEnv* env) {
360360
static jmethodID mid = env->GetMethodID(
361361
getIteratorClass(env), "next", "()Ljava/lang/Object;");
362362
assert(mid != nullptr);
363363
return mid;
364364
}
365-
365+
366366
// Get the java method id of arrayList constructor.
367367
static jmethodID getArrayListConstructorMethodId(JNIEnv* env, jclass jclazz) {
368368
static jmethodID mid = env->GetMethodID(
369369
jclazz, "<init>", "(I)V");
370370
assert(mid != nullptr);
371371
return mid;
372372
}
373-
373+
374374
// Get the java method id of java.util.List.add().
375375
static jmethodID getListAddMethodId(JNIEnv* env) {
376376
static jmethodID mid = env->GetMethodID(

java/rocksjni/rocksjni.cc

+12-12
Original file line numberDiff line numberDiff line change
@@ -249,37 +249,37 @@ jobject multi_get_helper(JNIEnv* env, jobject jdb, rocksdb::DB* db,
249249
const rocksdb::ReadOptions& rOpt, jobject jkey_list, jint jkeys_count) {
250250
std::vector<rocksdb::Slice> keys;
251251
std::vector<jbyte*> keys_to_free;
252-
252+
253253
// get iterator
254254
jobject iteratorObj = env->CallObjectMethod(
255255
jkey_list, rocksdb::ListJni::getIteratorMethod(env));
256-
256+
257257
// iterate over keys and convert java byte array to slice
258258
while(env->CallBooleanMethod(
259259
iteratorObj, rocksdb::ListJni::getHasNextMethod(env)) == JNI_TRUE) {
260260
jbyteArray jkey = (jbyteArray) env->CallObjectMethod(
261261
iteratorObj, rocksdb::ListJni::getNextMethod(env));
262262
jint key_length = env->GetArrayLength(jkey);
263-
263+
264264
jbyte* key = new jbyte[key_length];
265265
env->GetByteArrayRegion(jkey, 0, key_length, key);
266266
// store allocated jbyte to free it after multiGet call
267-
keys_to_free.push_back(key);
268-
267+
keys_to_free.push_back(key);
268+
269269
rocksdb::Slice key_slice(
270270
reinterpret_cast<char*>(key), key_length);
271271
keys.push_back(key_slice);
272272
}
273-
273+
274274
std::vector<std::string> values;
275275
std::vector<rocksdb::Status> s = db->MultiGet(rOpt, keys, &values);
276-
276+
277277
// Don't reuse class pointer
278-
jclass jclazz = env->FindClass("java/util/ArrayList");
278+
jclass jclazz = env->FindClass("java/util/ArrayList");
279279
jmethodID mid = rocksdb::ListJni::getArrayListConstructorMethodId(
280-
env, jclazz);
280+
env, jclazz);
281281
jobject jvalue_list = env->NewObject(jclazz, mid, jkeys_count);
282-
282+
283283
// insert in java list
284284
for(std::vector<rocksdb::Status>::size_type i = 0; i != s.size(); i++) {
285285
if(s[i].ok()) {
@@ -295,13 +295,13 @@ jobject multi_get_helper(JNIEnv* env, jobject jdb, rocksdb::DB* db,
295295
jvalue_list, rocksdb::ListJni::getListAddMethodId(env), nullptr);
296296
}
297297
}
298-
298+
299299
// free up allocated byte arrays
300300
for(std::vector<jbyte*>::size_type i = 0; i != keys_to_free.size(); i++) {
301301
delete[] keys_to_free[i];
302302
}
303303
keys_to_free.clear();
304-
304+
305305
return jvalue_list;
306306
}
307307

0 commit comments

Comments
 (0)