title: What is the best way to recycle Domino objects in Java Beans
body: <p>I use a function to get access to a configuration document: </p>
  
  <pre><code>private Document lookupDoc(String key1) {
      try {
          Session sess = ExtLibUtil.getCurrentSession();
          Database wDb = sess.getDatabase(sess.getServerName(), this.dbname1);
          View wView = wDb.getView(this.viewname1);
          Document wDoc = wView.getDocumentByKey(key1, true);
          this.debug("Got a doc for key: [" + key1 + "]");
          return wDoc;
      } catch (NotesException ne) {
          if (this.DispLookupErrors)
              ne.printStackTrace();
          this.lastErrorMsg = ne.text;
          this.debug(this.lastErrorMsg, "error");
      }
      return null;
  }
  </code></pre>
  
  <p>In another method I use this function to get the document:</p>
  
  <pre><code>Document wDoc = this.lookupDoc(key1);
  
  if (wdoc != null) {
      // do things with the document
      wdoc.recycle();
  }
  </code></pre>
  
  <p>Should I be recycling the Database and View objects when I recycle the Document object? Or should those be recycled before the function returns the Document?</p>