I have been fairly rigorous in recycling Notes Objects, but I have run into a situation where I can't recycle the object because it is passed back from a method to the calling code. So in a class I have this code:
public Database getAppDB() {
Database appDB = null;
try{
Session s = ExtLibUtil.getCurrentSession();
serverName = s.createName(s.getCurrentDatabase().getServer()).getCommon();
appDB = s.getDbDirectory(serverName).openDatabaseByReplicaID(this.getAppRepID());
return appDB;
}catch (NotesException e){
System.out.println(e.toString());
return appDB;
}finally{
Utils.recycleObjects(s);
}
}
Which openes a database then passes the appDB back to the calling program. Clearly if I instantiate the database in my calling program I will need to recycle it, but in this class method I can not recycle it because it is getting passed back. Am I creating a ticking time bomb with this? If so is there a way around the issue? This method could be called hundreds of time over the life cycle of session.