ref.releaseReference(); ref2.releaseReference();
ref.release(); ref2.release();
   public void testTwoStoresSameDatabase() throws Exception   {      Message m = MessageFactory.createMessage("message0", true, 777l, 888l, 9, headers, "payload");      assertEquals(0, ((JDBCPersistenceManager)pm).getMessageReferenceCount(m.getMessageID()));      MessageReference ref = ms.reference(m);      ref.acquireReference();      log.debug("referenced " + m + " using " + ms);      assertCorrectReference(ref, ms.getStoreID(), m);      assertEquals(1, ((JDBCPersistenceManager)pm).getMessageReferenceCount(m.getMessageID()));      // add the same message to the second store      MessageReference ref2 = ms2.reference(m);      ref2.acquireReference();      log.debug("referenced " + m + " using " + ms2);      assertCorrectReference(ref2, ms2.getStoreID(), m);      assertEquals(2, ((JDBCPersistenceManager)pm2).getMessageReferenceCount(m.getMessageID()));      assertFalse(ref == ref2);//      // send ref out of scope and call a full GC//      ref = null;//      System.gc();      ref.releaseReference();      // TODO - do I need to keep this here?      // wait a while (?) for garbage collection (on a multi-processor machine)      //Thread.sleep(3000);      // the reference is garbage collected and the message store is evicted ...      assertEquals(1, ((JDBCPersistenceManager)pm2).getMessageReferenceCount(m.getMessageID()));      // ... but because the message is still in the database, trying to get a new reference      // is successful.      ref = ms.getReference(m.getMessageID());      ref.acquireReference();      assertCorrectReference(ref, ms.getStoreID(), m);      assertCorrectReference(ms2.getReference(m.getMessageID()), ms2.getStoreID(), m);      assertEquals(2, ((JDBCPersistenceManager)pm2).getMessageReferenceCount(m.getMessageID()));//      // send both references out of scope and call a full GC//      ref = null;//      ref2 = null;//      System.gc();      ref.releaseReference();      ref2.releaseReference();      assertNull(ms.getReference(m.getMessageID()));      assertNull(ms2.getReference(m.getMessageID()));      assertEquals(0, ((JDBCPersistenceManager)pm2).getMessageReferenceCount(m.getMessageID()));   }