+ add dedicated transaction commit exception (to differentiate between generic tx system exception and optmistic locking ones)

This commit is contained in:
Costin Leau
2011-04-20 20:20:06 +03:00
parent 5ad8a98fd5
commit 923ba1086e
2 changed files with 44 additions and 3 deletions

View File

@@ -0,0 +1,43 @@
/*
* Copyright 2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.gemfire;
import com.gemstone.gemfire.cache.TransactionException;
/**
* Gemfire-specific subclass of {@link org.springframework.transaction.TransactionException}, indicating a transaction failure at commit time.
*
* @author Costin Leau
*/
public class GemfireTransactionCommitException extends TransactionException {
public GemfireTransactionCommitException() {
super();
}
public GemfireTransactionCommitException(String message, Throwable cause) {
super(message, cause);
}
public GemfireTransactionCommitException(String message) {
super(message);
}
public GemfireTransactionCommitException(Throwable cause) {
super(cause);
}
}

View File

@@ -22,7 +22,6 @@ import org.springframework.transaction.NoTransactionException;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionException;
import org.springframework.transaction.TransactionSystemException;
import org.springframework.transaction.support.AbstractPlatformTransactionManager;
import org.springframework.transaction.support.DefaultTransactionStatus;
import org.springframework.transaction.support.ResourceTransactionManager;
@@ -138,8 +137,7 @@ public class GemfireTransactionManager extends AbstractPlatformTransactionManage
throw new NoTransactionException(
"No transaction associated with the current thread; are there multiple transaction managers ?", ex);
} catch (CommitConflictException ex) {
// TODO: can this be replaced with HeuristicCompletionException ?
throw new TransactionSystemException("Unexpected failure on commit of Cache local transaction", ex);
throw new GemfireTransactionCommitException("Unexpected failure on commit of Cache local transaction", ex);
}
}