ARTEMIS-2953 - drop the use of non deterministic finalize
This commit is contained in:
parent
e84fb95144
commit
c4832c3209
|
@ -582,17 +582,6 @@ public final class Page implements Comparable<Page> {
|
|||
return otherPage.getPageId() - this.pageId;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize() {
|
||||
try {
|
||||
if (file != null && file.isOpen()) {
|
||||
file.close(false);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ActiveMQServerLogger.LOGGER.pageFinaliseError(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
|
|
|
@ -225,19 +225,20 @@ public class PageTest extends ActiveMQTestBase {
|
|||
|
||||
file = factory.createSequentialFile("00010.page");
|
||||
file.open();
|
||||
page = new Page(new SimpleString("something"), new NullStorageManager(), factory, file, 10);
|
||||
Page page1 = new Page(new SimpleString("something"), new NullStorageManager(), factory, file, 10);
|
||||
|
||||
List<PagedMessage> msgs = page.read(new NullStorageManager());
|
||||
List<PagedMessage> msgs = page1.read(new NullStorageManager());
|
||||
|
||||
Assert.assertEquals(numberOfElements, msgs.size());
|
||||
|
||||
Assert.assertEquals(numberOfElements, page.getNumberOfMessages());
|
||||
Assert.assertEquals(numberOfElements, page1.getNumberOfMessages());
|
||||
|
||||
for (int i = 0; i < msgs.size(); i++) {
|
||||
Assert.assertEquals(simpleDestination, msgs.get(i).getMessage().getAddressSimpleString());
|
||||
}
|
||||
|
||||
page.delete(null);
|
||||
page.close(false);
|
||||
page1.delete(null);
|
||||
|
||||
Assert.assertEquals(0, factory.listFiles("page").size());
|
||||
|
||||
|
|
|
@ -179,6 +179,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
|
|||
|
||||
Assert.assertEquals(1, storeImpl.getNumberOfPages());
|
||||
|
||||
storeImpl.stop();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -226,6 +227,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
|
|||
Assert.assertEquals(numMessages, msg.size());
|
||||
Assert.assertEquals(1, storeImpl.getNumberOfPages());
|
||||
|
||||
page.close(false);
|
||||
page = storeImpl.depage();
|
||||
|
||||
Assert.assertNull(page);
|
||||
|
@ -362,6 +364,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
|
|||
Assert.assertEquals(0, store.getNumberOfPages());
|
||||
|
||||
page.open();
|
||||
page.close(false);
|
||||
|
||||
}
|
||||
|
||||
|
@ -576,6 +579,8 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
|
|||
Assert.assertEquals(0, buffers2.size());
|
||||
|
||||
Assert.assertEquals(0, storeImpl.getAddressSize());
|
||||
|
||||
storeImpl.stop();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -791,6 +796,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
|
|||
Assert.assertEquals(msg.getMessageID(), msg.getLongProperty("count").longValue());
|
||||
msgsRead++;
|
||||
}
|
||||
page.close(false);
|
||||
}
|
||||
|
||||
storeImpl.stop();
|
||||
|
|
Loading…
Reference in New Issue