Mercurial > hg > Members > tatsuki > jungle-bench
annotate src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/mongo/readMongoThread.java @ 23:5b6322bb6fe7
write disk Performance time for PerformanceComparisonJungleMongo.java
author | tatsuki |
---|---|
date | Sat, 02 May 2015 02:25:36 +0900 |
parents | 306441e23b8b |
children | 69dca2ab1783 |
rev | line source |
---|---|
22 | 1 package jp.ac.u_ryukyu.ie.cr.tatsuki.mongo; |
2 | |
3 import com.mongodb.client.MongoCollection; | |
4 import com.mongodb.client.MongoCursor; | |
5 import org.bson.Document; | |
6 | |
7 | |
23
5b6322bb6fe7
write disk Performance time for PerformanceComparisonJungleMongo.java
tatsuki
parents:
22
diff
changeset
|
8 class ReadMongoThread extends Thread { |
22 | 9 |
10 MongoCollection<Document> mongoDB; | |
11 int findCount; | |
12 int successCount; | |
13 int faildCount; | |
14 boolean loop = true; | |
15 | |
16 public ReadMongoThread(MongoCollection<Document> mongoDB) { | |
17 this.mongoDB = mongoDB; | |
18 this.findCount = 0; | |
19 this.successCount = 0; | |
20 this.faildCount = 0; | |
21 } | |
22 | |
23 public int getFindCount() { | |
24 System.out.println("thread count = " + findCount); | |
25 return findCount; | |
26 } | |
27 | |
28 public void set(boolean loop) { | |
29 this.loop = loop; | |
30 } | |
31 | |
32 @Override | |
33 public void run() { | |
34 while (loop) { | |
35 MongoCursor<Document> result = mongoDB.find(new Document("Personid", "p:3")).iterator(); | |
36 if (result.hasNext()) | |
37 findCount++; | |
38 } | |
39 } | |
40 } |