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
Post a Comment