I am interacting with many db collections of MongoDB using Java driver. The queries are basically INSERT,DELETE and FETCH documents. Everything is working fine except the connections are open in the logs.
Below is the log file
Fri Dec 27 17:27:28.484 [initandlisten] connection accepted from 127.0.0.1:51018 #125 (41 connections now open)
Fri Dec 27 17:27:29.209 [initandlisten] connection accepted from 127.0.0.1:51020 #126 (42 connections now open)
Fri Dec 27 17:27:30.222 [initandlisten] connection accepted from 127.0.0.1:51021 #127 (43 connections now open)
Fri Dec 27 17:27:30.254 [conn126] end connection 127.0.0.1:51020 (42 connections now open)
Fri Dec 27 17:27:31.492 [conn125] info DFM::findAll(): extent 0:9f000 was empty, skipping ahead. ns:pingpong.SearchResult
Fri Dec 27 17:27:31.516 [conn125] end connection 127.0.0.1:51018 (41 connections now open)
Fri Dec 27 17:27:40.038 [initandlisten] connection accepted from 127.0.0.1:51032 #128 (42 connections now open)
Fri Dec 27 17:27:40.625 [initandlisten] connection accepted from 127.0.0.1:51033 #129 (43 connections now open)
Fri Dec 27 17:27:41.640 [initandlisten] connection accepted from 127.0.0.1:51034 #130 (44 connections now open)
Fri Dec 27 17:27:41.675 [conn129] end connection 127.0.0.1:51033 (43 connections now open)
Fri Dec 27 17:27:43.062 [conn128] end connection 127.0.0.1:51032 (42 connections now open)
Fri Dec 27 17:27:52.595 [initandlisten] connection accepted from 127.0.0.1:51037 #131 (43 connections now open)
Fri Dec 27 17:27:53.275 [initandlisten] connection accepted from 127.0.0.1:51038 #132 (44 connections now open)
Fri Dec 27 17:27:53.601 [conn131] info DFM::findAll(): extent 0:9f000 was empty, skipping ahead. ns:pingpong.SearchResult
Fri Dec 27 17:27:54.330 [initandlisten] connection accepted from 127.0.0.1:51039 #133 (45 connections now open)
Fri Dec 27 17:27:54.375 [conn132] end connection 127.0.0.1:51038 (44 connections now open)
Fri Dec 27 17:27:55.619 [conn131] end connection 127.0.0.1:51037 (43 connections now open)
Fri Dec 27 17:28:07.823 [initandlisten] connection accepted from 127.0.0.1:51042 #134 (44 connections now open)
Fri Dec 27 17:28:08.439 [initandlisten] connection accepted from 127.0.0.1:51043 #135 (45 connections now open)
Fri Dec 27 17:28:09.475 [initandlisten] connection accepted from 127.0.0.1:51044 #136 (46 connections now open)
Fri Dec 27 17:28:09.496 [conn135] info DFM::findAll(): extent 0:24000 was empty, skipping ahead. ns:pingpong.Messages
Fri Dec 27 17:28:09.509 [conn135] end connection 127.0.0.1:51043 (45 connections now open)
Fri Dec 27 17:28:10.838 [conn134] end connection 127.0.0.1:51042 (44 connections now open)
Sat Dec 28 04:10:58.018 [initandlisten] connection accepted from 127.0.0.1:53778 #137 (45 connections now open)
Sat Dec 28 04:11:04.501 [initandlisten] connection accepted from 127.0.0.1:53779 #138 (46 connections now open)
Sat Dec 28 04:11:05.561 [initandlisten] connection accepted from 127.0.0.1:53780 #139 (47 connections now open)
Sat Dec 28 04:11:05.621 [conn138] info DFM::findAll(): extent 0:24000 was empty, skipping ahead. ns:pingpong.Messages
Sat Dec 28 04:11:05.658 [conn138] info DFM::findAll(): extent 0:24000 was empty, skipping ahead. ns:pingpong.Messages
Sat Dec 28 04:11:05.699 [conn138] info DFM::findAll(): extent 0:24000 was empty, Sat Dec 28 04:11:05.737 [conn138] end connection 127.0.0.1:53779 (46 connections now open)
I am using mongoclient.close() after each of the INSERT,DELETE and FETCH commands. But still the connections are open. Am I missing something. The below is the delete code
MongoClient mongoclient;
String mobileID=getMobileID(messageid);
DBUtils dbUtils=new DBUtils();
mongoclient=dbUtils.connectToDB("pingpong");
dbUtils.deleteMessage(mobileID,messageid);
mongoclient.close();
Am I missing something. Please let me know.