Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-1870

Waiting for 30000 ms before timing out

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.1.0
    • Component/s: API
    • Environment:
      mongodb 3.0.3, jdk 1.6, Centos 3,
      Only one MongoDB server (14.0.xx.xxx, 27017)

      There is an timeout message to update a document on my mongodb.
      What is wrong ?

      Here is log message :

      INFO: No server chosen by PrimaryServerSelector from cluster description ClusterDescription{
        type=UNKNOWN, connectionMode=SINGLE, 
        all=[ServerDescription{address=14.0.xx.xxx:27017, type=UNKNOWN, state=CONNECTING}]}. 
       Waiting for 30000 ms before timing out
      

      Below is java code:

      MongoClient mongoClient = new MongoClient("14.0.xx.xxx", 27017);
      MongoDatabase db = client.getDatabase("axis");
      
      String axisDate = axis.substring(0, 10);
      int axisHour = Integer.parseInt(axis_hour);
      		
      String id = axisDate + "_" + gid + "_" + cname + "_" + axisHour;
      		
      Document key = new Document("_id", id); 
      Document value = new Document("$set", new Document("_id", id)
           .append("gid", gid)
           .append("service_name", cname)  										    
           .append("axis", axisDate)
           .append("axis_hour", axisHour)
           .append("bandwidth", bandwidth)
           .append("peak", peak));
      		
      UpdateOptions uo = new UpdateOptions();
      try {
           UpdateResult rs =      
           db.getCollection("video_cdn_traffic_log").updateOne(key, value, uo.upsert(true));
      }catch (MongoWriteException e) {
         e.printStackTrace();
      }catch (MongoWriteConcernException e) {
        e.printStackTrace();
      }catch (MongoException e) {
        e.printStackTrace();
      }finally{
        client.close();			
      }
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            arsis Jinho Choi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: