mongodb - mongo + java + too many open files -


i using mongo-java2.4jar communicating mongo server. in webapp using mongo=new mongo("serverip","port") ever required , once processing complete, closing mongo connection using mongo.close().

but after time getting following exception :

java.net.socketexception: many open files

i think when close connection not closing sockets. please me out figuring issue.

thanks!

the mongo class transparently connection pooling , should have 1 instance per jvm process. please @ http://api.mongodb.org/java/2.5-pre-/com/mongodb/mongo.html

if heavily create instances of class think acquire many connections before can released. create singleton on app startup whole application , place in application context. call close when app stops.

cheers,

sven


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -