Search in sources :

Example 1 with SMBException

use of org.alfresco.jlan.smb.SMBException in project alfresco-repository by Alfresco.

the class FilesystemTransactionAdvice method invoke.

public Object invoke(final MethodInvocation methodInvocation) throws IOException, SMBException, Throwable {
    RetryingTransactionHelper tran = transactionService.getRetryingTransactionHelper();
    RetryingTransactionCallback<Object> callback = new RetryingTransactionHelper.RetryingTransactionCallback<Object>() {

        public Object execute() throws Throwable {
            try {
                return methodInvocation.proceed();
            } catch (SMBException e) {
                throw new PropagatingException(e);
            } catch (IOControlNotImplementedException e) {
                throw new PropagatingException(e);
            } catch (IOException e) {
                // Ensure original checked IOExceptions get propagated
                throw new PropagatingException(e);
            } catch (DeviceContextException e) {
                throw new PropagatingException(e);
            }
        }
    };
    try {
        return tran.doInTransaction(callback, readOnly);
    } catch (PropagatingException pe) {
        Throwable t = pe.getCause();
        if (t != null) {
            if (t instanceof IOException) {
                throw (IOException) t;
            }
            if (t instanceof IOControlNotImplementedException) {
                throw (IOControlNotImplementedException) t;
            }
            if (t instanceof SMBException) {
                throw (SMBException) t;
            }
            if (t instanceof DeviceContextException) {
                throw t;
            }
            throw t;
        }
        throw pe;
    }
}
Also used : DeviceContextException(org.alfresco.jlan.server.core.DeviceContextException) SMBException(org.alfresco.jlan.smb.SMBException) RetryingTransactionHelper(org.alfresco.repo.transaction.RetryingTransactionHelper) RetryingTransactionCallback(org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback) IOControlNotImplementedException(org.alfresco.jlan.server.filesys.IOControlNotImplementedException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 DeviceContextException (org.alfresco.jlan.server.core.DeviceContextException)1 IOControlNotImplementedException (org.alfresco.jlan.server.filesys.IOControlNotImplementedException)1 SMBException (org.alfresco.jlan.smb.SMBException)1 RetryingTransactionHelper (org.alfresco.repo.transaction.RetryingTransactionHelper)1 RetryingTransactionCallback (org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback)1