Replication/Transfer tidy up:

- TransferFailureException: TransferEndEvent getEndEvent() -> TransferEventError getErrorEvent()
- Client cancel only processed on first request from client

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@22406 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2010-09-10 15:47:42 +00:00
parent b1350014c8
commit fc0821820a
2 changed files with 8 additions and 6 deletions

View File

@@ -268,7 +268,8 @@ public class ReplicationActionExecutor extends ActionExecuterAbstractBase {
{ {
TransferEventError failureEndEvent = ((TransferFailureException)e).getErrorEvent(); TransferEventError failureEndEvent = ((TransferFailureException)e).getErrorEvent();
writeDefinitionReports(replicationDef, failureEndEvent.getSourceReport(), failureEndEvent.getDestinationReport()); writeDefinitionReports(replicationDef, failureEndEvent.getSourceReport(), failureEndEvent.getDestinationReport());
throw new ReplicationServiceException("Error executing transfer - " + e.getCause().getMessage(), e); Throwable cause = (e.getCause() == null) ? e : e.getCause();
throw new ReplicationServiceException("Error executing transfer - " + cause.getMessage(), cause);
} }
writeDefinitionReports(replicationDef, null, null); writeDefinitionReports(replicationDef, null, null);
throw new ReplicationServiceException("Error executing transfer - " + e.getMessage(), e); throw new ReplicationServiceException("Error executing transfer - " + e.getMessage(), e);

View File

@@ -728,9 +728,8 @@ public class TransferServiceImpl2 implements TransferService2
logger.debug("TransferException - unable to transfer", failureException); logger.debug("TransferException - unable to transfer", failureException);
TransferEventError errorEvent = new TransferEventError(); TransferEventError errorEvent = new TransferEventError();
errorEvent.setTransferState(TransferEvent.TransferState.ERROR); errorEvent.setTransferState(TransferEvent.TransferState.ERROR);
TransferFailureException endException = new TransferFailureException(errorEvent); errorEvent.setException(failureException);
errorEvent.setMessage(endException.getMessage()); errorEvent.setMessage(failureException.getMessage());
errorEvent.setException(endException);
endEventImpl = errorEvent; endEventImpl = errorEvent;
} }
else if (cancelled) else if (cancelled)
@@ -832,7 +831,7 @@ public class TransferServiceImpl2 implements TransferService2
if (endEvent instanceof TransferEventError) if (endEvent instanceof TransferEventError)
{ {
TransferEventError endError = (TransferEventError)endEvent; TransferEventError endError = (TransferEventError)endEvent;
throw (TransferFailureException)endError.getException(); throw new TransferFailureException(endError);
} }
return endEvent; return endEvent;
} }
@@ -1044,8 +1043,9 @@ public class TransferServiceImpl2 implements TransferService2
TransferStatus status = transferMonitoring.get(transferHandle); TransferStatus status = transferMonitoring.get(transferHandle);
if(status != null) if(status != null)
{ {
if(status.cancelMe) if(!status.cancelInProgress && status.cancelMe)
{ {
status.cancelInProgress = true;
throw new TransferCancelledException(); throw new TransferCancelledException();
} }
} }
@@ -1394,6 +1394,7 @@ public class TransferServiceImpl2 implements TransferService2
private class TransferStatus private class TransferStatus
{ {
boolean cancelMe = false; boolean cancelMe = false;
boolean cancelInProgress = false;
} }