ARTEMIS-474 fixing page.close() deadlock with replica

This commit is contained in:
Clebert Suconic 2016-04-07 15:53:52 -04:00
parent 86a81d315d
commit 2e894554ca
4 changed files with 17 additions and 11 deletions

View File

@ -174,7 +174,7 @@ public class PageCursorProviderImpl implements PageCursorProvider {
finally {
try {
if (page != null) {
page.close();
page.close(false);
}
}
catch (Throwable ignored) {
@ -448,14 +448,14 @@ public class PageCursorProviderImpl implements PageCursorProvider {
}
finally {
try {
depagedPage.close();
depagedPage.close(false);
}
catch (Exception e) {
}
storageManager.afterPageRead();
}
depagedPage.close();
depagedPage.close(false);
pgdMessages = pgdMessagesList.toArray(new PagedMessage[pgdMessagesList.size()]);
}
else {

View File

@ -216,8 +216,14 @@ public final class Page implements Comparable<Page> {
file.position(0);
}
public synchronized void close() throws Exception {
if (storageManager != null) {
public void close() throws Exception {
close(false);
}
/** sendEvent means it's a close happening from a major event such moveNext.
* While reading the cache we don't need (and shouldn't inform the backup */
public synchronized void close(boolean sendEvent) throws Exception {
if (sendEvent && storageManager != null) {
storageManager.pageClosed(storeName, pageId);
}
if (pageCache != null) {

View File

@ -348,7 +348,7 @@ public class PagingStoreImpl implements PagingStore {
flushExecutors();
if (currentPage != null) {
currentPage.close();
currentPage.close(false);
currentPage = null;
}
}
@ -390,7 +390,7 @@ public class PagingStoreImpl implements PagingStore {
currentPageId = 0;
if (currentPage != null) {
currentPage.close();
currentPage.close(false);
}
currentPage = null;
@ -589,7 +589,7 @@ public class PagingStoreImpl implements PagingStore {
}
returnPage = currentPage;
returnPage.close();
returnPage.close(false);
currentPage = null;
// The current page is empty... which means we reached the end of the pages
@ -1021,7 +1021,7 @@ public class PagingStoreImpl implements PagingStore {
int tmpCurrentPageId = currentPageId + 1;
if (currentPage != null) {
currentPage.close();
currentPage.close(true);
}
currentPage = createPage(tmpCurrentPageId);

View File

@ -306,7 +306,7 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon
for (Page page : map.values()) {
try {
page.sync();
page.close();
page.close(false);
}
catch (Exception e) {
ActiveMQServerLogger.LOGGER.errorClosingPageOnReplication(e);
@ -698,7 +698,7 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon
}
}
else {
page.close();
page.close(false);
}
}