Refinements to RetryingTransactionHelper to make it equivalent to

executeInUserTransaction().
Changed the on close callback for write listeners to use a RetryingTransaction.
The point of this exercise is to make it possible for clients of the core server
to ignore transient resource contention failures.  CIFS, for example, will be able 
to take advantage of this, since a transient error condition currently results in a dead
share.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4597 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-12-13 17:03:44 +00:00
parent 4834c89f5a
commit e76fc329b6
10 changed files with 172 additions and 68 deletions

View File

@@ -28,6 +28,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.content.AbstractContentStore;
import org.alfresco.repo.content.ContentStore;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.service.cmr.repository.ContentIOException;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentStreamListener;
@@ -98,6 +99,7 @@ public class ReplicatingContentStore extends AbstractContentStore
private static Log logger = LogFactory.getLog(ReplicatingContentStore.class);
private TransactionService transactionService;
private RetryingTransactionHelper transactionHelper;
private ContentStore primaryStore;
private List<ContentStore> secondaryStores;
private boolean inbound;
@@ -130,6 +132,14 @@ public class ReplicatingContentStore extends AbstractContentStore
this.transactionService = transactionService;
}
/**
* Set the retrying transaction helper.
*/
public void setRetryingTransactionHelper(RetryingTransactionHelper helper)
{
this.transactionHelper = helper;
}
/**
* Set the primary store that content will be replicated to or from
*
@@ -291,7 +301,7 @@ public class ReplicatingContentStore extends AbstractContentStore
// attach the listener
ContentStreamListener listener = new ReplicatingWriteListener(secondaryStores, writer, outboundThreadPoolExecutor);
writer.addListener(listener);
writer.setTransactionService(transactionService); // mandatory when listeners are added
writer.setRetryingTransactionHelper(transactionHelper); // mandatory when listeners are added
}
// done