ReadPreferenceServerSelector

时间:2017-06-21 07:14:46

标签: java mongodb

我正在使用新发布的Mongodb Java异步驱动程序。我正在写一些简单的测试代码,它们是:

MongoClient mongoClient = MongoClients.create("mongodb://192.168.1.162:27017");
MongoDatabase database = mongoClient.getDatabase("mongodb1");
MongoCollection<Document> collection = database.getCollection("t_test");
collection.count(
          new SingleResultCallback<Long>() {
              @Override
              public void onResult(final Long count, final Throwable t) {
                  System.out.println(count);
              }
          });

System.out.println("AAAAAAAAAAAAAAAAAAAAAAAAA------end”);

但是,未调用回调函数,控制台输出为:

  

2017-06-21 13:57:58 [INFO]使用设置{hosts = [192.168.1.162:27017],mode = SINGLE,requiredClusterType = UNKNOWN,serverSelectionTimeout =&#39; 30000 ms&#39;创建的群集,maxWaitQueueSize = 500}   2017-06-21 13:57:58 [DEBUG]将集群描述更新为{type = UNKNOWN,servers = [{address = 192.168.1.162:27017,type = UNKNOWN,state = CONNECTING}]   2017-06-21 13:57:58 [INFO] ReadPreferenceServerSelector {readPreference = primary}从集群描述ClusterDescription {type = UNKNOWN,connectionMode = SINGLE,all = [ServerDescription {address = 192.168.1.162:27017,type = UNKNOWN,state = CONNECTING}]}。在超时之前等待30000毫秒

0 个答案:

没有答案