Organizational Research By

Surprising Reserch Topic

mongodb open connection issue


mongodb open connection issue  using -'java,mongodb'

I have the following log in my mongo console:

Tue Jul 23 17:20:01.301 [initandlisten] waiting for connections on port 27017
Tue Jul 23 17:20:01.401 [websvr] admin web console waiting for connections on port 28017
Tue Jul 23 17:20:01.569 [initandlisten] connection accepted from 127.0.0.1:58090 #1 (1 connection now open)
Tue Jul 23 17:20:01.570 [initandlisten] connection accepted from 127.0.0.1:58089 #2 (2 connections now open)
Tue Jul 23 17:20:21.799 [initandlisten] connection accepted from 127.0.0.1:58113 #3 (3 connections now open)
....
....
....


likewise the log goes on and now it is in 112. Each time when i start mongo server this happens. I only have a singleton connection in my code. What can be the issue here:

public static DB getConnection(String databaseName) throws AppConnectionException {

    if (null != db) {
        Logger.debug("Returning existing db connection...!");
        return db;
    }

    Logger.debug("Creating new db connection...!");
    final String connStr = PropertyRetreiver.getPropertyFromConfigurationFile("rawdata.url");

    try {

        final MongoClientURI uri = new MongoClientURI(connStr);
        final MongoClient client = new MongoClient(uri);
        db = client.getDB(databaseName);

    } catch (UnknownHostException e) {
        throw new AppConnectionException(
                "Unable to connect to the given host / port.");
    }

    return db;
}

    
asked Sep 30, 2015 by rajesh
0 votes
5 views



Related Hot Questions



Government Jobs Opening


...