cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dar...@apache.org
Subject [40/47] git commit: updated refs/heads/master to c910196
Date Wed, 23 Oct 2013 19:43:57 GMT
Cleaner and more type safe Transaction API for checked exceptions


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/edeaf981
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/edeaf981
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/edeaf981

Branch: refs/heads/master
Commit: edeaf98117e6c02403dfe0cbae741e4eb7e75a0c
Parents: 323bbcc
Author: Darren Shepherd <darren.s.shepherd@gmail.com>
Authored: Wed Oct 23 10:02:43 2013 -0700
Committer: Darren Shepherd <darren.s.shepherd@gmail.com>
Committed: Wed Oct 23 10:02:43 2013 -0700

----------------------------------------------------------------------
 .../com/cloud/vm/VirtualMachineManagerImpl.java |  13 +-
 .../orchestration/NetworkOrchestrator.java      |  18 +-
 .../db/src/com/cloud/utils/db/Transaction.java  |  30 +--
 .../utils/db/TransactionCallbackNoReturn.java   |   2 +-
 .../db/TransactionCallbackWithException.java    |   4 +-
 ...ransactionCallbackWithExceptionNoReturn.java |  32 +++
 .../utils/db/TransactionWrappedExeception.java  |  36 ----
 .../com/cloud/utils/db/TestTransaction.java     |  22 +-
 .../cloud/network/element/CiscoVnmcElement.java |  10 +-
 .../lb/ElasticLoadBalancerManagerImpl.java      |   6 +-
 .../ExternalLoadBalancerDeviceManagerImpl.java  |   6 +-
 .../com/cloud/network/IpAddressManagerImpl.java | 213 ++++++++++---------
 .../com/cloud/network/NetworkServiceImpl.java   |  10 +-
 .../network/StorageNetworkManagerImpl.java      |   4 +-
 .../network/firewall/FirewallManagerImpl.java   |   4 +-
 .../cloud/network/guru/DirectNetworkGuru.java   |   9 +-
 .../network/guru/DirectPodBasedNetworkGuru.java |  11 +-
 .../lb/LoadBalancingRulesManagerImpl.java       |   4 +-
 .../cloud/network/rules/RulesManagerImpl.java   |  17 +-
 .../security/SecurityGroupManagerImpl.java      |   4 +-
 .../com/cloud/network/vpc/VpcManagerImpl.java   |  17 +-
 .../network/vpn/RemoteAccessVpnManagerImpl.java |   4 +-
 .../com/cloud/projects/ProjectManagerImpl.java  |  10 +-
 .../resourcelimit/ResourceLimitManagerImpl.java |  11 +-
 .../cloud/server/ConfigurationServerImpl.java   |   9 +-
 server/src/com/cloud/test/DatabaseConfig.java   |   9 +-
 server/src/com/cloud/vm/UserVmManagerImpl.java  |  13 +-
 .../vm/snapshot/VMSnapshotManagerImpl.java      |   9 +-
 .../lb/ApplicationLoadBalancerManagerImpl.java  |   5 +-
 29 files changed, 264 insertions(+), 278 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
index 51310da..e0c4835 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -167,6 +167,7 @@ import com.cloud.utils.db.Transaction;
 import com.cloud.utils.db.TransactionCallback;
 import com.cloud.utils.db.TransactionCallbackNoReturn;
 import com.cloud.utils.db.TransactionCallbackWithException;
+import com.cloud.utils.db.TransactionCallbackWithExceptionNoReturn;
 import com.cloud.utils.db.TransactionStatus;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.exception.ExecutionException;
@@ -337,9 +338,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
 
         final VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(vmFinal, template, serviceOffering, null, null);
 
-        Transaction.executeWithException(new TransactionCallbackWithException<Object>() {
+        Transaction.execute(new TransactionCallbackWithExceptionNoReturn<InsufficientCapacityException>() {
             @Override
-            public Object doInTransaction(TransactionStatus status) throws InsufficientCapacityException {
+            public void doInTransactionWithoutResult(TransactionStatus status) throws InsufficientCapacityException {
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug("Allocating nics for " + vmFinal);
                 }
@@ -365,10 +366,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
                 for (Map.Entry<? extends DiskOffering, Long> offering : dataDiskOfferingsFinal.entrySet()) {
                     volumeMgr.allocateRawVolume(Type.DATADISK, "DATA-" + vmFinal.getId(), offering.getKey(), offering.getValue(), vmFinal, template, owner);
                 }
-                
-                return null;
             }
-        }, InsufficientCapacityException.class);
+        });
 
         if (s_logger.isDebugEnabled()) {
             s_logger.debug("Allocation completed for VM: " + vmFinal);
@@ -566,7 +565,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
             try {
                 final ItWorkVO workFinal = work;
                 Ternary<VMInstanceVO, ReservationContext, ItWorkVO> result = 
-                        Transaction.executeWithException(new TransactionCallbackWithException<Ternary<VMInstanceVO, ReservationContext, ItWorkVO>>() {
+                        Transaction.execute(new TransactionCallbackWithException<Ternary<VMInstanceVO, ReservationContext, ItWorkVO>, NoTransitionException>() {
                     @Override
                     public Ternary<VMInstanceVO, ReservationContext, ItWorkVO> doInTransaction(TransactionStatus status) throws NoTransitionException {
                         Journal journal = new Journal.LogJournal("Creating " + vm, s_logger);
@@ -582,7 +581,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
 
                         return new Ternary<VMInstanceVO, ReservationContext, ItWorkVO>(null, null, work);
                     }
-                }, NoTransitionException.class);
+                });
                 
                 work = result.third();
                 if (result.first() != null)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
index 7ba9b1b..dbc0714 100755
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
@@ -169,7 +169,7 @@ import com.cloud.utils.db.EntityManager;
 import com.cloud.utils.db.GlobalLock;
 import com.cloud.utils.db.TransactionCallback;
 import com.cloud.utils.db.TransactionCallbackNoReturn;
-import com.cloud.utils.db.TransactionCallbackWithException;
+import com.cloud.utils.db.TransactionCallbackWithExceptionNoReturn;
 import com.cloud.utils.db.TransactionStatus;
 import com.cloud.utils.db.JoinBuilder.JoinType;
 import com.cloud.utils.db.SearchBuilder;
@@ -687,9 +687,9 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
     public void allocate(final VirtualMachineProfile vm, final LinkedHashMap<? extends Network, ? extends NicProfile> networks) throws InsufficientCapacityException,
         ConcurrentOperationException {
 
-        Transaction.executeWithException(new TransactionCallbackWithException<Object>() {
+        Transaction.execute(new TransactionCallbackWithExceptionNoReturn<InsufficientCapacityException>() {
             @Override
-            public Object doInTransaction(TransactionStatus status) throws InsufficientCapacityException {
+            public void doInTransactionWithoutResult(TransactionStatus status) throws InsufficientCapacityException {
                 int deviceId = 0;
         
                 boolean[] deviceIds = new boolean[networks.size()];
@@ -750,10 +750,8 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                 if (nics.size() == 1) {
                     nics.get(0).setDefaultNic(true);
                 }
-                
-                return null;
             }
-        }, InsufficientCapacityException.class);
+        });
     }
 
     @DB
@@ -2470,15 +2468,13 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
             final LinkedHashMap<Network, NicProfile> profiles = new LinkedHashMap<Network, NicProfile>();
             profiles.put(network, null);
 
-            Transaction.executeWithException(new TransactionCallbackWithException<Object>() {
+            Transaction.execute(new TransactionCallbackWithExceptionNoReturn<InsufficientCapacityException>() {
                 @Override
-                public Object doInTransaction(TransactionStatus status) throws Exception {
+                public void doInTransactionWithoutResult(TransactionStatus status) throws InsufficientCapacityException {
                     cleanupNics(vm);
                     allocate(vm, profiles);
-
-                    return null;
                 }
-            }, InsufficientCapacityException.class);
+            });
         }
         return true;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/framework/db/src/com/cloud/utils/db/Transaction.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/Transaction.java b/framework/db/src/com/cloud/utils/db/Transaction.java
index d65b87e..4b19be0 100755
--- a/framework/db/src/com/cloud/utils/db/Transaction.java
+++ b/framework/db/src/com/cloud/utils/db/Transaction.java
@@ -18,14 +18,13 @@ package com.cloud.utils.db;
 
 import java.util.concurrent.atomic.AtomicLong;
 
-import com.cloud.utils.exception.ExceptionUtil;
-
 public class Transaction {
     private final static AtomicLong counter = new AtomicLong(0);
     private final static TransactionStatus STATUS = new TransactionStatus() {
     };
 
-    public static <T> T execute(TransactionCallback<T> callback) {
+    @SuppressWarnings("deprecation")
+    public static <T,E extends Throwable> T execute(TransactionCallbackWithException<T,E> callback) throws E {
         String name = "tx-" + counter.incrementAndGet();
         short databaseId = TransactionLegacy.CLOUD_DB;
         TransactionLegacy currentTxn = TransactionLegacy.currentTxn(false);
@@ -43,24 +42,13 @@ public class Transaction {
         }
     }
 
-    public static <T,X extends Exception> T executeWithException(final TransactionCallbackWithException<T> callback, Class<X> exception) throws X {
-        try {
-            return execute(new TransactionCallback<T>() {
-                @Override
-                public T doInTransaction(TransactionStatus status) {
-                    try {
-                        return callback.doInTransaction(status);
-                    } catch (Exception e) {
-                        ExceptionUtil.rethrowRuntime(e);
-                        throw new TransactionWrappedExeception(e);
-                    }
-                }
-            });
-        } catch (TransactionWrappedExeception e) {
-            ExceptionUtil.rethrowRuntime(e.getWrapped());
-            ExceptionUtil.rethrow(e.getWrapped(), exception);
-            throw e;
-        }
+    public static <T> T execute(final TransactionCallback<T> callback) {
+        return execute(new TransactionCallbackWithException<T, RuntimeException>() {
+            @Override
+            public T doInTransaction(TransactionStatus status) throws RuntimeException {
+                return callback.doInTransaction(status);
+            }
+        });
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/framework/db/src/com/cloud/utils/db/TransactionCallbackNoReturn.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/TransactionCallbackNoReturn.java b/framework/db/src/com/cloud/utils/db/TransactionCallbackNoReturn.java
index a2263e5..2db290a 100644
--- a/framework/db/src/com/cloud/utils/db/TransactionCallbackNoReturn.java
+++ b/framework/db/src/com/cloud/utils/db/TransactionCallbackNoReturn.java
@@ -3,7 +3,7 @@ package com.cloud.utils.db;
 public abstract class TransactionCallbackNoReturn implements TransactionCallback<Object> {
 
 	@Override
-	public Object doInTransaction(TransactionStatus status) {
+	public final Object doInTransaction(TransactionStatus status) {
 		doInTransactionWithoutResult(status);
 		return null;
 	}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/framework/db/src/com/cloud/utils/db/TransactionCallbackWithException.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/TransactionCallbackWithException.java b/framework/db/src/com/cloud/utils/db/TransactionCallbackWithException.java
index cbf3fbd..67d7826 100644
--- a/framework/db/src/com/cloud/utils/db/TransactionCallbackWithException.java
+++ b/framework/db/src/com/cloud/utils/db/TransactionCallbackWithException.java
@@ -1,7 +1,7 @@
 package com.cloud.utils.db;
 
-public interface TransactionCallbackWithException<T> {
+public interface TransactionCallbackWithException<T,E extends Throwable> {
 
-	public T doInTransaction(TransactionStatus status) throws Exception;
+	public T doInTransaction(TransactionStatus status) throws E;
 	
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/framework/db/src/com/cloud/utils/db/TransactionCallbackWithExceptionNoReturn.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/TransactionCallbackWithExceptionNoReturn.java b/framework/db/src/com/cloud/utils/db/TransactionCallbackWithExceptionNoReturn.java
new file mode 100644
index 0000000..d5bc44f
--- /dev/null
+++ b/framework/db/src/com/cloud/utils/db/TransactionCallbackWithExceptionNoReturn.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 com.cloud.utils.db;
+
+public abstract class TransactionCallbackWithExceptionNoReturn<E extends Throwable> implements TransactionCallbackWithException<Boolean, E> {
+
+    @Override
+    public final Boolean doInTransaction(TransactionStatus status) throws E {
+        doInTransactionWithoutResult(status);
+        return true;
+    }
+
+    public abstract void doInTransactionWithoutResult(TransactionStatus status) throws E;
+
+}
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/framework/db/src/com/cloud/utils/db/TransactionWrappedExeception.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/TransactionWrappedExeception.java b/framework/db/src/com/cloud/utils/db/TransactionWrappedExeception.java
deleted file mode 100644
index 70d4c16..0000000
--- a/framework/db/src/com/cloud/utils/db/TransactionWrappedExeception.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 com.cloud.utils.db;
-
-import com.cloud.utils.exception.CloudRuntimeException;
-
-public class TransactionWrappedExeception extends CloudRuntimeException {
-
-    private static final long serialVersionUID = -3254037624055143300L;
-
-    Exception e;
-
-    public TransactionWrappedExeception(Exception e) {
-        this.e = e;
-    }
-
-    public Exception getWrapped() {
-        return e;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/framework/db/test/com/cloud/utils/db/TestTransaction.java
----------------------------------------------------------------------
diff --git a/framework/db/test/com/cloud/utils/db/TestTransaction.java b/framework/db/test/com/cloud/utils/db/TestTransaction.java
index ea277c7..4ee08f1 100644
--- a/framework/db/test/com/cloud/utils/db/TestTransaction.java
+++ b/framework/db/test/com/cloud/utils/db/TestTransaction.java
@@ -23,6 +23,7 @@ import static org.mockito.Mockito.*;
 
 import java.io.FileNotFoundException;
 import java.sql.Connection;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import org.junit.After;
 import org.junit.Before;
@@ -88,14 +89,14 @@ public class TestTransaction {
     @Test
     public void testRollbackWithException() throws Exception {
         try {
-            Transaction.executeWithException(new TransactionCallbackWithException<Object>() {
+            Transaction.execute(new TransactionCallbackWithException<Object,FileNotFoundException>() {
                 @Override
                 public Object doInTransaction(TransactionStatus status) throws FileNotFoundException {
                     assertEquals(TransactionLegacy.CLOUD_DB, TransactionLegacy.currentTxn().getDatabaseId().shortValue());
 
                     throw new FileNotFoundException("Panic!");
                 }
-            }, FileNotFoundException.class);
+            });
             fail();
         } catch (FileNotFoundException e) {
             assertEquals("Panic!", e.getMessage());
@@ -108,6 +109,23 @@ public class TestTransaction {
     }
     
     @Test
+    public void testWithExceptionNoReturn() throws Exception {
+        final AtomicInteger i = new AtomicInteger(0);
+        assertTrue(Transaction.execute(new TransactionCallbackWithExceptionNoReturn<FileNotFoundException>() {
+            @Override
+            public void doInTransactionWithoutResult(TransactionStatus status) throws FileNotFoundException {
+                i.incrementAndGet();
+            }
+        }));
+        
+        assertEquals(1, i.get());
+        verify(conn).setAutoCommit(false);
+        verify(conn, times(1)).commit();
+        verify(conn, times(0)).rollback();
+        verify(conn, times(1)).close();
+    }
+    
+    @Test
     public void testOtherdatabaseRollback() throws Exception {
         after();
         setup(TransactionLegacy.AWSAPI_DB);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java
index 37de4de..5beb1ba 100644
--- a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java
+++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java
@@ -124,7 +124,7 @@ import com.cloud.utils.component.AdapterBase;
 import com.cloud.utils.db.EntityManager;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.db.TransactionCallback;
-import com.cloud.utils.db.TransactionCallbackWithException;
+import com.cloud.utils.db.TransactionCallbackWithExceptionNoReturn;
 import com.cloud.utils.db.TransactionStatus;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.exception.ExceptionUtil;
@@ -317,9 +317,9 @@ public class CiscoVnmcElement extends AdapterBase implements SourceNatServicePro
         }
 
         try {
-            Transaction.executeWithException(new TransactionCallbackWithException<Object>() {
+            Transaction.execute(new TransactionCallbackWithExceptionNoReturn<Exception>() {
                 @Override
-                public Object doInTransaction(TransactionStatus status) throws InsufficientAddressCapacityException, ResourceUnavailableException {
+                public void doInTransactionWithoutResult(TransactionStatus status) throws InsufficientAddressCapacityException, ResourceUnavailableException {
 
                     // ensure that there is an ASA 1000v assigned to this network
                     CiscoAsa1000vDevice assignedAsa = assignAsa1000vToNetwork(network);
@@ -419,10 +419,8 @@ public class CiscoVnmcElement extends AdapterBase implements SourceNatServicePro
                         throw new CloudRuntimeException("Failed to associate Cisco ASA 1000v (" + assignedAsa.getManagementIp() +
                                 ") with logical edge firewall in VNMC for network " + network.getName());
                     }
-
-                    return null;
                 }
-            }, Exception.class);
+            });
         } catch (CloudRuntimeException e) {
             s_logger.error("CiscoVnmcElement failed", e);
             return false;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java
index cf4c2f0..f2bda39 100644
--- a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java
+++ b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java
@@ -587,9 +587,9 @@ public class ElasticLoadBalancerManagerImpl extends ManagerBase implements Elast
     
     @DB
     public PublicIp allocDirectIp(final Account account, final long guestNetworkId) throws InsufficientAddressCapacityException {
-        return Transaction.executeWithException(new TransactionCallbackWithException<PublicIp>() {
+        return Transaction.execute(new TransactionCallbackWithException<PublicIp,InsufficientAddressCapacityException>() {
             @Override
-            public PublicIp doInTransaction(TransactionStatus status) throws Exception {
+            public PublicIp doInTransaction(TransactionStatus status) throws InsufficientAddressCapacityException {
                 Network frontEndNetwork = _networkModel.getNetwork(guestNetworkId);
 
                 PublicIp ip = _ipAddrMgr.assignPublicIpAddress(frontEndNetwork.getDataCenterId(), null, account, VlanType.DirectAttached, frontEndNetwork.getId(), null, true);
@@ -600,7 +600,7 @@ public class ElasticLoadBalancerManagerImpl extends ManagerBase implements Elast
 
                 return ip;
             }
-        }, InsufficientAddressCapacityException.class);
+        });
     }
     
     public void releaseIp(long ipId, long userId, Account caller) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java b/server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java
index 59df3e8..6ca40c0 100644
--- a/server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java
+++ b/server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java
@@ -422,9 +422,9 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
                         final boolean dedicatedLB = offering.getDedicatedLB(); // does network offering supports a dedicated load balancer?
 
                         try {
-                            lbDevice = Transaction.executeWithException(new TransactionCallbackWithException<ExternalLoadBalancerDeviceVO>() {
+                            lbDevice = Transaction.execute(new TransactionCallbackWithException<ExternalLoadBalancerDeviceVO,InsufficientCapacityException>() {
                                 @Override
-                                public ExternalLoadBalancerDeviceVO doInTransaction(TransactionStatus status) throws Exception {
+                                public ExternalLoadBalancerDeviceVO doInTransaction(TransactionStatus status) throws InsufficientCapacityException {
                                     // FIXME: should the device allocation be done during network implement phase or do a
                                     // lazy allocation when first rule for the network is configured??
         
@@ -442,7 +442,7 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
                                     _externalLoadBalancerDeviceDao.update(lbDeviceId, lbDevice);
                                     return lbDevice;
                                 }
-                            }, InsufficientCapacityException.class);
+                            });
 
                             // allocated load balancer for the network, so skip retry
                             tryLbProvisioning = false;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/server/src/com/cloud/network/IpAddressManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/IpAddressManagerImpl.java b/server/src/com/cloud/network/IpAddressManagerImpl.java
index dd30aa1..8619ae1 100644
--- a/server/src/com/cloud/network/IpAddressManagerImpl.java
+++ b/server/src/com/cloud/network/IpAddressManagerImpl.java
@@ -146,8 +146,10 @@ import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.Transaction;
+import com.cloud.utils.db.TransactionCallbackWithExceptionNoReturn;
 import com.cloud.utils.db.TransactionStatus;
 import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.utils.exception.ExceptionUtil;
 import com.cloud.utils.net.Ip;
 import com.cloud.utils.net.NetUtils;
 import com.cloud.vm.Nic;
@@ -657,7 +659,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
     @DB
     public PublicIp fetchNewPublicIp(final long dcId, final Long podId, final List<Long> vlanDbIds, final Account owner, final VlanType vlanUse, final Long guestNetworkId, final boolean sourceNat, final boolean assign,
             final String requestedIp, final boolean isSystem, final Long vpcId) throws InsufficientAddressCapacityException {
-        IPAddressVO addr = Transaction.executeWithException(new TransactionCallbackWithException<IPAddressVO>() {
+        IPAddressVO addr = Transaction.execute(new TransactionCallbackWithException<IPAddressVO,InsufficientAddressCapacityException>() {
             @Override
             public IPAddressVO doInTransaction(TransactionStatus status) throws InsufficientAddressCapacityException {
                 StringBuilder errorMessage = new StringBuilder("Unable to get ip adress in ");
@@ -786,7 +788,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
 
                 return addr;
             }
-        }, InsufficientAddressCapacityException.class);
+        });
 
         if (vlanUse == VlanType.VirtualNetwork) {
             _firewallMgr.addSystemFirewallRules(addr, owner);
@@ -870,7 +872,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
 
         PublicIp ip = null;
         try {
-            ip = Transaction.executeWithException(new TransactionCallbackWithException<PublicIp>() {
+            ip = Transaction.execute(new TransactionCallbackWithException<PublicIp,InsufficientAddressCapacityException>() {
                 @Override
                 public PublicIp doInTransaction(TransactionStatus status) throws InsufficientAddressCapacityException {
                     Account owner = _accountDao.acquireInLockTable(ownerId);
@@ -893,7 +895,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
 
                     return ip;
                 }
-            }, InsufficientAddressCapacityException.class);
+            });
 
             return ip;
         } finally {
@@ -1017,7 +1019,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
                 s_logger.debug("Associate IP address lock acquired");
             }
 
-            ip = Transaction.executeWithException(new TransactionCallbackWithException<PublicIp>() {
+            ip = Transaction.execute(new TransactionCallbackWithException<PublicIp,InsufficientAddressCapacityException>() {
                 @Override
                 public PublicIp doInTransaction(TransactionStatus status) throws InsufficientAddressCapacityException {
                     PublicIp ip = fetchNewPublicIp(zone.getId(), null, null, ipOwner, vlanType, null, false, assign, null, isSystem, null);
@@ -1034,7 +1036,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
 
                     return ip;
                 }
-            }, InsufficientAddressCapacityException.class);
+            });
 
         } finally {
             if (accountToLock != null) {
@@ -1059,9 +1061,9 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
         try {
             portableIpLock.lock(5);
 
-            ipaddr = Transaction.executeWithException(new TransactionCallbackWithException<IPAddressVO>() {
+            ipaddr = Transaction.execute(new TransactionCallbackWithException<IPAddressVO,InsufficientAddressCapacityException>() {
                 @Override
-                public IPAddressVO doInTransaction(TransactionStatus status) throws Exception {
+                public IPAddressVO doInTransaction(TransactionStatus status) throws InsufficientAddressCapacityException {
                     PortableIpVO allocatedPortableIp;
 
                     List<PortableIpVO> portableIpVOs = _portableIpDao.listByRegionIdAndState(1, PortableIp.State.Free);
@@ -1120,7 +1122,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
 
                     return ipaddr;
                 }
-            }, InsufficientAddressCapacityException.class);
+            });
         } finally {
             portableIpLock.unlock();
         }
@@ -1498,100 +1500,108 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
             throw new InvalidParameterValueException("Network " + guestNetworkFinal + " is not of a type " + TrafficType.Guest);
         }
 
-        Ternary<Boolean,List<NetworkOfferingVO>, Network> pair = Transaction.executeWithException(new TransactionCallbackWithException<Ternary<Boolean,List<NetworkOfferingVO>, Network>>() {
-            @Override
-            public Ternary<Boolean,List<NetworkOfferingVO>, Network> doInTransaction(TransactionStatus status) throws Exception {
-                boolean createNetwork = false;
-                Network guestNetwork = guestNetworkFinal;
-
-                if (guestNetwork == null) {
-                    List<? extends Network> networks = getIsolatedNetworksWithSourceNATOwnedByAccountInZone(zoneId, owner);
-                    if (networks.size() == 0) {
-                        createNetwork = true;
-                    } else if (networks.size() == 1) {
-                        guestNetwork = networks.get(0);
-                    } else {
-                        throw new InvalidParameterValueException("Error, more than 1 Guest Isolated Networks with SourceNAT "
-                                                                 + "service enabled found for this account, cannot assosiate the IP range, please provide the network ID");
-                    }
-                }
-        
-                // create new Virtual network (Isolated with SourceNAT) for the user if it doesn't exist
-                List<NetworkOfferingVO> requiredOfferings = _networkOfferingDao.listByAvailability(Availability.Required, false);
-                if (requiredOfferings.size() < 1) {
-                    throw new CloudRuntimeException("Unable to find network offering with availability=" + Availability.Required +
-                                                    " to automatically create the network as part of createVlanIpRange");
-                }
-                if (createNetwork) {
-                    if (requiredOfferings.get(0).getState() == NetworkOffering.State.Enabled) {
-                        long physicalNetworkId = _networkModel.findPhysicalNetworkId(zoneId, requiredOfferings.get(0).getTags(), requiredOfferings.get(0).getTrafficType());
-                        // Validate physical network
-                        PhysicalNetwork physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId);
-                        if (physicalNetwork == null) {
-                            throw new InvalidParameterValueException("Unable to find physical network with id: " + physicalNetworkId + " and tag: " + requiredOfferings.get(0).getTags());
-                        }
-        
-                        s_logger.debug("Creating network for account " + owner + " from the network offering id=" + requiredOfferings.get(0).getId() +
-                                       " as a part of createVlanIpRange process");
-                        guestNetwork = _networkMgr.createGuestNetwork(requiredOfferings.get(0).getId(),
-                            owner.getAccountName() + "-network",
-                            owner.getAccountName() + "-network",
-                            null,
-                            null,
-                            null,
-                            null,
-                            owner,
-                            null,
-                            physicalNetwork,
-                            zoneId,
-                            ACLType.Account,
-                            null,
-                            null,
-                            null,
-                            null,
-                            true,
-                            null);
-                        if (guestNetwork == null) {
-                            s_logger.warn("Failed to create default Virtual network for the account " + accountId + "in zone " + zoneId);
-                            throw new CloudRuntimeException("Failed to create a Guest Isolated Networks with SourceNAT " +
-                                                            "service enabled as a part of createVlanIpRange, for the account " + accountId + "in zone " + zoneId);
+        Ternary<Boolean,List<NetworkOfferingVO>, Network> pair = null;
+        try {
+            pair = Transaction.execute(new TransactionCallbackWithException<Ternary<Boolean,List<NetworkOfferingVO>, Network>,Exception>() {
+                @Override
+                public Ternary<Boolean,List<NetworkOfferingVO>, Network> doInTransaction(TransactionStatus status) throws InsufficientCapacityException, ResourceAllocationException {
+                    boolean createNetwork = false;
+                    Network guestNetwork = guestNetworkFinal;
+
+                    if (guestNetwork == null) {
+                        List<? extends Network> networks = getIsolatedNetworksWithSourceNATOwnedByAccountInZone(zoneId, owner);
+                        if (networks.size() == 0) {
+                            createNetwork = true;
+                        } else if (networks.size() == 1) {
+                            guestNetwork = networks.get(0);
+                        } else {
+                            throw new InvalidParameterValueException("Error, more than 1 Guest Isolated Networks with SourceNAT "
+                                                                     + "service enabled found for this account, cannot assosiate the IP range, please provide the network ID");
                         }
-                    } else {
-                        throw new CloudRuntimeException("Required network offering id=" + requiredOfferings.get(0).getId() + " is not in " + NetworkOffering.State.Enabled);
                     }
-                }
-        
-                // Check if there is a source nat ip address for this account; if not - we have to allocate one
-                boolean allocateSourceNat = false;
-                List<IPAddressVO> sourceNat = _ipAddressDao.listByAssociatedNetwork(guestNetwork.getId(), true);
-                if (sourceNat.isEmpty()) {
-                    allocateSourceNat = true;
-                }
-        
-                // update all ips with a network id, mark them as allocated and update resourceCount/usage
-                List<IPAddressVO> ips = _ipAddressDao.listByVlanId(vlanId);
-                boolean isSourceNatAllocated = false;
-                for (IPAddressVO addr : ips) {
-                    if (addr.getState() != State.Allocated) {
-                        if (!isSourceNatAllocated && allocateSourceNat) {
-                            addr.setSourceNat(true);
-                            isSourceNatAllocated = true;
+            
+                    // create new Virtual network (Isolated with SourceNAT) for the user if it doesn't exist
+                    List<NetworkOfferingVO> requiredOfferings = _networkOfferingDao.listByAvailability(Availability.Required, false);
+                    if (requiredOfferings.size() < 1) {
+                        throw new CloudRuntimeException("Unable to find network offering with availability=" + Availability.Required +
+                                                        " to automatically create the network as part of createVlanIpRange");
+                    }
+                    if (createNetwork) {
+                        if (requiredOfferings.get(0).getState() == NetworkOffering.State.Enabled) {
+                            long physicalNetworkId = _networkModel.findPhysicalNetworkId(zoneId, requiredOfferings.get(0).getTags(), requiredOfferings.get(0).getTrafficType());
+                            // Validate physical network
+                            PhysicalNetwork physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId);
+                            if (physicalNetwork == null) {
+                                throw new InvalidParameterValueException("Unable to find physical network with id: " + physicalNetworkId + " and tag: " + requiredOfferings.get(0).getTags());
+                            }
+            
+                            s_logger.debug("Creating network for account " + owner + " from the network offering id=" + requiredOfferings.get(0).getId() +
+                                           " as a part of createVlanIpRange process");
+                            guestNetwork = _networkMgr.createGuestNetwork(requiredOfferings.get(0).getId(),
+                                owner.getAccountName() + "-network",
+                                owner.getAccountName() + "-network",
+                                null,
+                                null,
+                                null,
+                                null,
+                                owner,
+                                null,
+                                physicalNetwork,
+                                zoneId,
+                                ACLType.Account,
+                                null,
+                                null,
+                                null,
+                                null,
+                                true,
+                                null);
+                            if (guestNetwork == null) {
+                                s_logger.warn("Failed to create default Virtual network for the account " + accountId + "in zone " + zoneId);
+                                throw new CloudRuntimeException("Failed to create a Guest Isolated Networks with SourceNAT " +
+                                                                "service enabled as a part of createVlanIpRange, for the account " + accountId + "in zone " + zoneId);
+                            }
                         } else {
-                            addr.setSourceNat(false);
+                            throw new CloudRuntimeException("Required network offering id=" + requiredOfferings.get(0).getId() + " is not in " + NetworkOffering.State.Enabled);
                         }
-                        addr.setAssociatedWithNetworkId(guestNetwork.getId());
-                        addr.setVpcId(guestNetwork.getVpcId());
-                        addr.setAllocatedTime(new Date());
-                        addr.setAllocatedInDomainId(owner.getDomainId());
-                        addr.setAllocatedToAccountId(owner.getId());
-                        addr.setSystem(false);
-                        addr.setState(IpAddress.State.Allocating);
-                        markPublicIpAsAllocated(addr);
                     }
+            
+                    // Check if there is a source nat ip address for this account; if not - we have to allocate one
+                    boolean allocateSourceNat = false;
+                    List<IPAddressVO> sourceNat = _ipAddressDao.listByAssociatedNetwork(guestNetwork.getId(), true);
+                    if (sourceNat.isEmpty()) {
+                        allocateSourceNat = true;
+                    }
+            
+                    // update all ips with a network id, mark them as allocated and update resourceCount/usage
+                    List<IPAddressVO> ips = _ipAddressDao.listByVlanId(vlanId);
+                    boolean isSourceNatAllocated = false;
+                    for (IPAddressVO addr : ips) {
+                        if (addr.getState() != State.Allocated) {
+                            if (!isSourceNatAllocated && allocateSourceNat) {
+                                addr.setSourceNat(true);
+                                isSourceNatAllocated = true;
+                            } else {
+                                addr.setSourceNat(false);
+                            }
+                            addr.setAssociatedWithNetworkId(guestNetwork.getId());
+                            addr.setVpcId(guestNetwork.getVpcId());
+                            addr.setAllocatedTime(new Date());
+                            addr.setAllocatedInDomainId(owner.getDomainId());
+                            addr.setAllocatedToAccountId(owner.getId());
+                            addr.setSystem(false);
+                            addr.setState(IpAddress.State.Allocating);
+                            markPublicIpAsAllocated(addr);
+                        }
+                    }
+                    return new Ternary<Boolean,List<NetworkOfferingVO>, Network>(createNetwork, requiredOfferings, guestNetwork);
                 }
-                return new Ternary<Boolean,List<NetworkOfferingVO>, Network>(createNetwork, requiredOfferings, guestNetwork);
-            }
-        }, InsufficientCapacityException.class);
+            });
+        } catch (Exception e1) {
+            ExceptionUtil.rethrowRuntime(e1);
+            ExceptionUtil.rethrow(e1, InsufficientCapacityException.class);
+            ExceptionUtil.rethrow(e1, ResourceAllocationException.class);
+            throw new IllegalStateException(e1);
+        }
 
         boolean createNetwork = pair.first();
         List<NetworkOfferingVO> requiredOfferings = pair.second();
@@ -1850,9 +1860,9 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
     @DB
     public void allocateDirectIp(final NicProfile nic, final DataCenter dc, final VirtualMachineProfile vm, final Network network, final String requestedIpv4, final String requestedIpv6)
         throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException {
-        Transaction.executeWithException(new TransactionCallbackWithException<Object>() {
+        Transaction.execute(new TransactionCallbackWithExceptionNoReturn<InsufficientAddressCapacityException>() {
             @Override
-            public Object doInTransaction(TransactionStatus status) throws InsufficientAddressCapacityException {
+            public void doInTransactionWithoutResult(TransactionStatus status) throws InsufficientAddressCapacityException {
                 //This method allocates direct ip for the Shared network in Advance zones
                 boolean ipv4 = false;
 
@@ -1913,11 +1923,8 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
                     nic.setIp6Dns1(dc.getIp6Dns1());
                     nic.setIp6Dns2(dc.getIp6Dns2());
                 }
-
-                return null;
             }
-        }, InsufficientAddressCapacityException.class);
-
+        });
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/server/src/com/cloud/network/NetworkServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java
index e0e90d9..c9a14cd 100755
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@ -1304,9 +1304,9 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
             final Account ownerFinal, final String cidr, final boolean createVlan) throws InsufficientCapacityException,
             ResourceAllocationException {
         try {
-            return Transaction.executeWithException(new TransactionCallbackWithException<Network>() {
+            return Transaction.execute(new TransactionCallbackWithException<Network,Exception>() {
                 @Override
-                public Network doInTransaction(TransactionStatus status) throws Exception {
+                public Network doInTransaction(TransactionStatus status) throws InsufficientCapacityException, ResourceAllocationException {
                     Account owner = ownerFinal;
                     Boolean subdomainAccess = subdomainAccessFinal;
                     
@@ -1368,7 +1368,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
                     }
                     return network;
                 }
-            }, Exception.class);
+            });
         } catch (Exception e) {
             ExceptionUtil.rethrowRuntime(e);
             ExceptionUtil.rethrow(e, InsufficientCapacityException.class);
@@ -3898,7 +3898,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
 
         final NetworkOfferingVO ntwkOffFinal = ntwkOff; 
         try {
-            return Transaction.executeWithException(new TransactionCallbackWithException<Network>() {
+            return Transaction.execute(new TransactionCallbackWithException<Network,Exception>() {
                 @Override
                 public Network doInTransaction(TransactionStatus status) throws ResourceAllocationException, InsufficientCapacityException {
                     //lock datacenter as we need to get mac address seq from there
@@ -3941,7 +3941,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
             
                     return privateNetwork;
                 }
-            }, Exception.class);
+            });
         } catch (Exception e) {
             ExceptionUtil.rethrowRuntime(e);
             ExceptionUtil.rethrow(e, ResourceAllocationException.class);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/server/src/com/cloud/network/StorageNetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/StorageNetworkManagerImpl.java b/server/src/com/cloud/network/StorageNetworkManagerImpl.java
index 73b45ab..4719a42 100755
--- a/server/src/com/cloud/network/StorageNetworkManagerImpl.java
+++ b/server/src/com/cloud/network/StorageNetworkManagerImpl.java
@@ -224,7 +224,7 @@ public class StorageNetworkManagerImpl extends ManagerBase implements StorageNet
         StorageNetworkIpRangeVO range = null;
 
         final String endIpFinal = endIp;
-        return Transaction.executeWithException(new TransactionCallbackWithException<StorageNetworkIpRangeVO>() {
+        return Transaction.execute(new TransactionCallbackWithException<StorageNetworkIpRangeVO,SQLException>() {
             @Override
             public StorageNetworkIpRangeVO doInTransaction(TransactionStatus status) throws SQLException {
                 StorageNetworkIpRangeVO range = new StorageNetworkIpRangeVO(zoneId, podId, nw.getId(), startIp, endIpFinal, vlan, netmask, cmd.getGateWay());
@@ -244,7 +244,7 @@ public class StorageNetworkManagerImpl extends ManagerBase implements StorageNet
 
                 return range;
             }
-        }, SQLException.class);
+        });
     }
 
     private String getInUseIpAddress(long rangeId) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/server/src/com/cloud/network/firewall/FirewallManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/firewall/FirewallManagerImpl.java b/server/src/com/cloud/network/firewall/FirewallManagerImpl.java
index e0d23ad..01504ab 100644
--- a/server/src/com/cloud/network/firewall/FirewallManagerImpl.java
+++ b/server/src/com/cloud/network/firewall/FirewallManagerImpl.java
@@ -226,7 +226,7 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService,
 
         final Long accountIdFinal = accountId;
         final Long domainIdFinal = domainId;
-        return Transaction.executeWithException(new TransactionCallbackWithException<FirewallRuleVO>() {
+        return Transaction.execute(new TransactionCallbackWithException<FirewallRuleVO,NetworkRuleConflictException>() {
             @Override
             public FirewallRuleVO doInTransaction(TransactionStatus status) throws NetworkRuleConflictException {
                 FirewallRuleVO newRule = new FirewallRuleVO(xId, ipAddrId, portStart, portEnd, protocol.toLowerCase(), networkId,
@@ -244,7 +244,7 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService,
                 
                 return newRule;
             }
-        }, NetworkRuleConflictException.class);
+        });
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/server/src/com/cloud/network/guru/DirectNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/DirectNetworkGuru.java b/server/src/com/cloud/network/guru/DirectNetworkGuru.java
index 65bc699..801d252 100755
--- a/server/src/com/cloud/network/guru/DirectNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/DirectNetworkGuru.java
@@ -58,6 +58,7 @@ import com.cloud.utils.db.DB;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.db.TransactionCallbackNoReturn;
 import com.cloud.utils.db.TransactionCallbackWithException;
+import com.cloud.utils.db.TransactionCallbackWithExceptionNoReturn;
 import com.cloud.utils.db.TransactionStatus;
 import com.cloud.utils.exception.ExceptionUtil;
 import com.cloud.vm.Nic;
@@ -237,9 +238,9 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
             InsufficientAddressCapacityException {
 
         try {
-            Transaction.executeWithException(new TransactionCallbackWithException<Object>() {
+            Transaction.execute(new TransactionCallbackWithExceptionNoReturn<InsufficientCapacityException>() {
                 @Override
-                public Object doInTransaction(TransactionStatus status) throws InsufficientCapacityException {
+                public void doInTransactionWithoutResult(TransactionStatus status) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException {
                     _ipAddrMgr.allocateDirectIp(nic, dc, vm, network, requestedIp4Addr, requestedIp6Addr);
                     //save the placeholder nic if the vm is the Virtual router
                     if (vm.getType() == VirtualMachine.Type.DomainRouter) {
@@ -249,10 +250,8 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
                             _networkMgr.savePlaceholderNic(network, nic.getIp4Address(), nic.getIp6Address(), VirtualMachine.Type.DomainRouter);
                         }
                     }
-                    
-                    return null;
                 }
-            }, InsufficientCapacityException.class);
+            });
         } catch (InsufficientCapacityException e) {
             ExceptionUtil.rethrow(e, InsufficientVirtualNetworkCapcityException.class);
             ExceptionUtil.rethrow(e, InsufficientAddressCapacityException.class);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/server/src/com/cloud/network/guru/DirectPodBasedNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/DirectPodBasedNetworkGuru.java b/server/src/com/cloud/network/guru/DirectPodBasedNetworkGuru.java
index 691135f..053a786 100755
--- a/server/src/com/cloud/network/guru/DirectPodBasedNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/DirectPodBasedNetworkGuru.java
@@ -52,9 +52,8 @@ import com.cloud.offering.NetworkOffering;
 import com.cloud.offerings.dao.NetworkOfferingDao;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.Transaction;
-import com.cloud.utils.db.TransactionCallback;
 import com.cloud.utils.db.TransactionCallbackNoReturn;
-import com.cloud.utils.db.TransactionCallbackWithException;
+import com.cloud.utils.db.TransactionCallbackWithExceptionNoReturn;
 import com.cloud.utils.db.TransactionStatus;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.vm.Nic;
@@ -170,9 +169,9 @@ public class DirectPodBasedNetworkGuru extends DirectNetworkGuru {
             InsufficientAddressCapacityException, ConcurrentOperationException {
         final DataCenter dc = _dcDao.findById(pod.getDataCenterId());
         if (nic.getIp4Address() == null) {
-            Transaction.executeWithException(new TransactionCallbackWithException<Object>() {
+            Transaction.execute(new TransactionCallbackWithExceptionNoReturn<InsufficientAddressCapacityException>() {
                 @Override
-                public Object doInTransaction(TransactionStatus status) throws InsufficientAddressCapacityException {
+                public void doInTransactionWithoutResult(TransactionStatus status) throws InsufficientAddressCapacityException {
                     PublicIp ip = null;
                     List<PodVlanMapVO> podRefs = _podVlanDao.listPodVlanMapsByPod(pod.getId());
                     String podRangeGateway = null;
@@ -213,10 +212,8 @@ public class DirectPodBasedNetworkGuru extends DirectNetworkGuru {
                             _networkMgr.savePlaceholderNic(network, nic.getIp4Address(), null, VirtualMachine.Type.DomainRouter);
                         }
                     }
-                    
-                    return null;
                 }
-            }, InsufficientAddressCapacityException.class);
+            });
         }
         nic.setDns1(dc.getDns1());
         nic.setDns2(dc.getDns2());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
index 60bb40b..780a942 100755
--- a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
+++ b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
@@ -1456,7 +1456,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
                 Purpose.LoadBalancing, FirewallRuleType.User, networkId, null);
 
 
-        return Transaction.executeWithException(new TransactionCallbackWithException<LoadBalancerVO>() {
+        return Transaction.execute(new TransactionCallbackWithException<LoadBalancerVO,NetworkRuleConflictException>() {
             @Override
             public LoadBalancerVO doInTransaction(TransactionStatus status) throws NetworkRuleConflictException {
                 LoadBalancerVO newRule = new LoadBalancerVO(xId, name, description,
@@ -1507,7 +1507,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
                     }
                 }
             }
-        }, NetworkRuleConflictException.class);
+        });
 
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/server/src/com/cloud/network/rules/RulesManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/rules/RulesManagerImpl.java b/server/src/com/cloud/network/rules/RulesManagerImpl.java
index 83f0493..d98dd29 100755
--- a/server/src/com/cloud/network/rules/RulesManagerImpl.java
+++ b/server/src/com/cloud/network/rules/RulesManagerImpl.java
@@ -79,6 +79,7 @@ import com.cloud.utils.db.TransactionCallbackNoReturn;
 import com.cloud.utils.db.TransactionCallbackWithException;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.Transaction;
+import com.cloud.utils.db.TransactionCallbackWithExceptionNoReturn;
 import com.cloud.utils.db.TransactionStatus;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.net.Ip;
@@ -312,7 +313,7 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
 
             final Ip dstIpFinal = dstIp;
             final IPAddressVO ipAddressFinal = ipAddress;
-            return Transaction.executeWithException(new TransactionCallbackWithException<PortForwardingRuleVO>() {
+            return Transaction.execute(new TransactionCallbackWithException<PortForwardingRuleVO,NetworkRuleConflictException>() {
                 @Override
                 public PortForwardingRuleVO doInTransaction(TransactionStatus status) throws NetworkRuleConflictException {
                     PortForwardingRuleVO newRule = new PortForwardingRuleVO(rule.getXid(), rule.getSourceIpAddressId(),
@@ -350,7 +351,7 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
                         throw new CloudRuntimeException("Unable to add rule for the ip id=" + ipAddrId, e);
                     }
                 }
-            }, NetworkRuleConflictException.class);
+            });
 
         } finally {
             // release ip address if ipassoc was perfored
@@ -395,7 +396,7 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
 
         //String dstIp = _networkModel.getIpInNetwork(ipAddress.getAssociatedWithVmId(), networkId);
         final String dstIp = ipAddress.getVmIp();
-        return Transaction.executeWithException(new TransactionCallbackWithException<StaticNatRule>() {
+        return Transaction.execute(new TransactionCallbackWithException<StaticNatRule,NetworkRuleConflictException>() {
             @Override
             public StaticNatRule doInTransaction(TransactionStatus status) throws NetworkRuleConflictException {
 
@@ -434,7 +435,7 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
                     throw new CloudRuntimeException("Unable to add static nat rule for the ip id=" + newRule.getSourceIpAddressId(), e);
                 }
             }
-        }, NetworkRuleConflictException.class);
+        });
 
     }
 
@@ -1154,9 +1155,9 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
             final boolean openFirewall, final Account caller, final int... ports) throws NetworkRuleConflictException {
         final FirewallRuleVO[] rules = new FirewallRuleVO[ports.length];
 
-        Transaction.executeWithException(new TransactionCallbackWithException<Object>() {
+        Transaction.execute(new TransactionCallbackWithExceptionNoReturn<NetworkRuleConflictException>() {
             @Override
-            public Object doInTransaction(TransactionStatus status) throws NetworkRuleConflictException {
+            public void doInTransactionWithoutResult(TransactionStatus status) throws NetworkRuleConflictException {
                 for (int i = 0; i < ports.length; i++) {
         
                     rules[i] = new FirewallRuleVO(null, ip.getId(), ports[i], protocol, ip.getAssociatedWithNetworkId(), ip.getAllocatedToAccountId(), ip.getAllocatedInDomainId(), purpose, null, null, null, null);
@@ -1167,10 +1168,8 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
                                 rules[i].getId(), ip.getAssociatedWithNetworkId());
                     }
                 }
-                
-                return null;
             }
-        }, NetworkRuleConflictException.class);
+        });
 
         boolean success = false;
         try {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/server/src/com/cloud/network/security/SecurityGroupManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/security/SecurityGroupManagerImpl.java b/server/src/com/cloud/network/security/SecurityGroupManagerImpl.java
index 85b01b3..c7b6e1e 100755
--- a/server/src/com/cloud/network/security/SecurityGroupManagerImpl.java
+++ b/server/src/com/cloud/network/security/SecurityGroupManagerImpl.java
@@ -1101,7 +1101,7 @@ public class SecurityGroupManagerImpl extends ManagerBase implements SecurityGro
         // check permissions
         _accountMgr.checkAccess(caller, null, true, group);
 
-        return Transaction.executeWithException(new TransactionCallbackWithException<Boolean>() {
+        return Transaction.execute(new TransactionCallbackWithException<Boolean,ResourceInUseException>() {
             @Override
             public Boolean doInTransaction(TransactionStatus status) throws ResourceInUseException {
                 SecurityGroupVO group = _securityGroupDao.lockRow(groupId, true);
@@ -1127,7 +1127,7 @@ public class SecurityGroupManagerImpl extends ManagerBase implements SecurityGro
         
                 return true;
             }
-        }, ResourceInUseException.class);
+        });
 
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/server/src/com/cloud/network/vpc/VpcManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/VpcManagerImpl.java b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
index 8ab06b8..c072bfa 100644
--- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
@@ -121,6 +121,7 @@ import com.cloud.utils.db.SearchCriteria;
 import com.cloud.utils.db.TransactionCallback;
 import com.cloud.utils.db.TransactionCallbackNoReturn;
 import com.cloud.utils.db.TransactionCallbackWithException;
+import com.cloud.utils.db.TransactionCallbackWithExceptionNoReturn;
 import com.cloud.utils.db.TransactionStatus;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.Transaction;
@@ -1405,7 +1406,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
         final PhysicalNetwork physNetFinal = physNet;
         VpcGatewayVO gatewayVO = null;
         try {
-            gatewayVO = Transaction.executeWithException(new TransactionCallbackWithException<VpcGatewayVO>() {
+            gatewayVO = Transaction.execute(new TransactionCallbackWithException<VpcGatewayVO,Exception>() {
                 @Override
                 public VpcGatewayVO doInTransaction(TransactionStatus status) throws ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException {
                     s_logger.debug("Creating Private gateway for VPC " + vpc);
@@ -1465,7 +1466,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
                     
                     return gatewayVO;
                 }
-            }, Exception.class);
+            });
         } catch (Exception e) {
             ExceptionUtil.rethrowRuntime(e);
             ExceptionUtil.rethrow(e, InsufficientCapacityException.class);
@@ -1822,7 +1823,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
             throw new InvalidParameterValueException("The static gateway cidr overlaps with one of the blacklisted routes of the zone the VPC belongs to");
         }
 
-        return Transaction.executeWithException(new TransactionCallbackWithException<StaticRouteVO>() {
+        return Transaction.execute(new TransactionCallbackWithException<StaticRouteVO, NetworkRuleConflictException>() {
             @Override
             public StaticRouteVO doInTransaction(TransactionStatus status) throws NetworkRuleConflictException {
                 StaticRouteVO newRoute = new StaticRouteVO(gateway.getId(), cidr, vpc.getId(), vpc.getAccountId(), vpc.getDomainId());
@@ -1838,7 +1839,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
                 
                 return newRoute;
             }
-        }, NetworkRuleConflictException.class);
+        });
     }
 
     protected boolean isCidrBlacklisted(String cidr, long zoneId) {
@@ -1981,9 +1982,9 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
                 }
 
                 try {
-                    Transaction.executeWithException(new TransactionCallbackWithException<Object>() {
+                    Transaction.execute(new TransactionCallbackWithExceptionNoReturn<Exception>() {
                         @Override
-                        public Object doInTransaction(TransactionStatus status) throws Exception {
+                        public void doInTransactionWithoutResult(TransactionStatus status) throws Exception {
                             // Cleanup inactive VPCs
                             List<VpcVO> inactiveVpcs = _vpcDao.listInactiveVpcs();
                             s_logger.info("Found " + inactiveVpcs.size() + " removed VPCs to cleanup");
@@ -1991,10 +1992,8 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
                                 s_logger.debug("Cleaning up " + vpc);
                                 destroyVpc(vpc, _accountMgr.getAccount(Account.ACCOUNT_ID_SYSTEM), User.UID_SYSTEM);
                             }
-                            
-                            return null;
                         }
-                    }, Exception.class);
+                    });
                 } catch (Exception e) {
                     s_logger.error("Exception ", e);
                 } finally {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
index 7912df4..7cf3167 100755
--- a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
+++ b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
@@ -193,7 +193,7 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements RemoteAcc
         final String newIpRange = NetUtils.long2Ip(++startIp) + "-" + range[1];
         final String sharedSecret = PasswordGenerator.generatePresharedKey(_pskLength);
         
-        return Transaction.executeWithException(new TransactionCallbackWithException<RemoteAccessVpn>() {
+        return Transaction.execute(new TransactionCallbackWithException<RemoteAccessVpn, NetworkRuleConflictException>() {
             @Override
             public RemoteAccessVpn doInTransaction(TransactionStatus status) throws NetworkRuleConflictException {
                 _rulesMgr.reservePorts(ipAddr, NetUtils.UDP_PROTO, Purpose.Vpn, openFirewall, caller, NetUtils.VPN_PORT, NetUtils.VPN_L2TP_PORT, NetUtils.VPN_NATT_PORT);
@@ -201,7 +201,7 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements RemoteAcc
                         publicIpId, range[0], newIpRange, sharedSecret);
                 return _remoteAccessVpnDao.persist(vpnVO);
             }
-        }, NetworkRuleConflictException.class);
+        });
     }
 
     private void validateRemoteAccessVpnConfiguration() throws ConfigurationException {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/server/src/com/cloud/projects/ProjectManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/projects/ProjectManagerImpl.java b/server/src/com/cloud/projects/ProjectManagerImpl.java
index 193a49e..22e2020 100755
--- a/server/src/com/cloud/projects/ProjectManagerImpl.java
+++ b/server/src/com/cloud/projects/ProjectManagerImpl.java
@@ -84,7 +84,7 @@ import com.cloud.utils.db.DB;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.db.TransactionCallback;
 import com.cloud.utils.db.TransactionCallbackNoReturn;
-import com.cloud.utils.db.TransactionCallbackWithException;
+import com.cloud.utils.db.TransactionCallbackWithExceptionNoReturn;
 import com.cloud.utils.db.TransactionStatus;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.sun.mail.smtp.SMTPMessage;
@@ -469,9 +469,9 @@ public class ProjectManagerImpl extends ManagerBase implements ProjectManager {
         //verify permissions
         _accountMgr.checkAccess(caller,AccessType.ModifyProject, true, _accountMgr.getAccount(project.getProjectAccountId()));
 
-        Transaction.executeWithException(new TransactionCallbackWithException<Object>() {
+        Transaction.execute(new TransactionCallbackWithExceptionNoReturn<ResourceAllocationException>() {
             @Override
-            public Object doInTransaction(TransactionStatus status) throws ResourceAllocationException {
+            public void doInTransactionWithoutResult(TransactionStatus status) throws ResourceAllocationException {
                 if (displayText != null) {
                     project.setDisplayText(displayText);
                     _projectDao.update(projectId, project);
@@ -509,10 +509,8 @@ public class ProjectManagerImpl extends ManagerBase implements ProjectManager {
                         s_logger.trace("Future owner " + newOwnerName + "is already the owner of the project id=" + projectId);
                     }
                }
-                
-                return null;
             }
-        }, ResourceAllocationException.class);
+        });
 
 
         return _projectDao.findById(projectId);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java b/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
index bfe32ec..7417754 100755
--- a/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
+++ b/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
@@ -91,8 +91,7 @@ import com.cloud.utils.db.JoinBuilder;
 import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria;
 import com.cloud.utils.db.TransactionCallback;
-import com.cloud.utils.db.TransactionCallbackNoReturn;
-import com.cloud.utils.db.TransactionCallbackWithException;
+import com.cloud.utils.db.TransactionCallbackWithExceptionNoReturn;
 import com.cloud.utils.db.TransactionStatus;
 import com.cloud.utils.db.SearchCriteria.Func;
 import com.cloud.utils.db.SearchCriteria.Op;
@@ -379,9 +378,9 @@ public class ResourceLimitManagerImpl extends ManagerBase implements ResourceLim
         }
 
         final Project projectFinal = project;
-        Transaction.executeWithException(new TransactionCallbackWithException<Object>() {
+        Transaction.execute(new TransactionCallbackWithExceptionNoReturn<ResourceAllocationException>() {
             @Override
-            public Object doInTransaction(TransactionStatus status) throws ResourceAllocationException {
+            public void doInTransactionWithoutResult(TransactionStatus status) throws ResourceAllocationException {
                 // Lock all rows first so nobody else can read it
                 Set<Long> rowIdsToLock = _resourceCountDao.listAllRowsToUpdate(account.getId(), ResourceOwnerType.Account, type);
                 SearchCriteria<ResourceCountVO> sc = ResourceCountSearch.create();
@@ -423,10 +422,8 @@ public class ResourceLimitManagerImpl extends ManagerBase implements ResourceLim
                     }
                     domainId = domain.getParent();
                 }
-                
-                return null;
             }
-        }, ResourceAllocationException.class);
+        });
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/server/src/com/cloud/server/ConfigurationServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java
index 1761a32..f8141ee 100755
--- a/server/src/com/cloud/server/ConfigurationServerImpl.java
+++ b/server/src/com/cloud/server/ConfigurationServerImpl.java
@@ -109,6 +109,7 @@ import com.cloud.utils.db.Transaction;
 import com.cloud.utils.db.TransactionCallback;
 import com.cloud.utils.db.TransactionCallbackNoReturn;
 import com.cloud.utils.db.TransactionCallbackWithException;
+import com.cloud.utils.db.TransactionCallbackWithExceptionNoReturn;
 import com.cloud.utils.db.TransactionLegacy;
 import com.cloud.utils.db.TransactionStatus;
 import com.cloud.utils.exception.CloudRuntimeException;
@@ -837,9 +838,9 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
         final HostPodVO pod = new HostPodVO(podName, zoneId, gateway, cidrAddress, cidrSize, ipRange);
         try {
             final String endIpFinal = endIp;
-            Transaction.executeWithException(new TransactionCallbackWithException<Object>() {
+            Transaction.execute(new TransactionCallbackWithExceptionNoReturn<InternalErrorException>() {
                 @Override
-                public Object doInTransaction(TransactionStatus status) throws InternalErrorException {
+                public void doInTransactionWithoutResult(TransactionStatus status) throws InternalErrorException {
                     if (_podDao.persist(pod) == null) {
                         throw new InternalErrorException("Failed to create new pod. Please contact Cloud Support.");
                     }
@@ -860,10 +861,8 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
                     } else {
                         _zoneDao.addLinkLocalIpAddress(zoneId, pod.getId(), linkLocalIpRanges[0], linkLocalIpRanges[1]);
                     }
-                    
-                    return null;
                 }
-            }, InternalErrorException.class);
+            });
         } catch (Exception e) {
             s_logger.error("Unable to create new pod due to " + e.getMessage(), e);
             throw new InternalErrorException("Failed to create new pod. Please contact Cloud Support.");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/server/src/com/cloud/test/DatabaseConfig.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/test/DatabaseConfig.java b/server/src/com/cloud/test/DatabaseConfig.java
index 6f76a3a..9370218 100755
--- a/server/src/com/cloud/test/DatabaseConfig.java
+++ b/server/src/com/cloud/test/DatabaseConfig.java
@@ -59,6 +59,7 @@ import com.cloud.utils.db.DB;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.db.TransactionCallbackNoReturn;
 import com.cloud.utils.db.TransactionCallbackWithException;
+import com.cloud.utils.db.TransactionCallbackWithExceptionNoReturn;
 import com.cloud.utils.db.TransactionLegacy;
 import com.cloud.utils.db.TransactionStatus;
 import com.cloud.utils.net.NfsUtils;
@@ -419,9 +420,9 @@ public class DatabaseConfig {
             final DbConfigXMLHandler handler = new DbConfigXMLHandler();
             handler.setParent(this);
 
-            Transaction.executeWithException(new TransactionCallbackWithException<Object>() {
+            Transaction.execute(new TransactionCallbackWithExceptionNoReturn<Exception>() {
                 @Override
-                public Object doInTransaction(TransactionStatus status) throws Exception {
+                public void doInTransactionWithoutResult(TransactionStatus status) throws Exception {
                     // Save user configured values for all fields
                     saxParser.parse(configFile, handler);
         
@@ -429,10 +430,8 @@ public class DatabaseConfig {
                     saveVMTemplate();
                     saveRootDomain();
                     saveDefaultConfiguations();
-
-                    return null;
                 }
-            }, Exception.class);
+            });
 
             // Check pod CIDRs against each other, and against the guest ip network/netmask
             pzc.checkAllPodCidrSubnets();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 5053a97..86f9855 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -243,6 +243,7 @@ import com.cloud.utils.db.TransactionCallbackNoReturn;
 import com.cloud.utils.db.SearchCriteria.Func;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.db.TransactionCallbackWithException;
+import com.cloud.utils.db.TransactionCallbackWithExceptionNoReturn;
 import com.cloud.utils.db.TransactionStatus;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.exception.ExecutionException;
@@ -1412,9 +1413,9 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
             s_logger.debug("Recovering vm " + vmId);
         }
 
-        Transaction.executeWithException(new TransactionCallbackWithException<Object>() {
+        Transaction.execute(new TransactionCallbackWithExceptionNoReturn<ResourceAllocationException>() {
             @Override
-            public Object doInTransaction(TransactionStatus status) throws ResourceAllocationException {
+            public void doInTransactionWithoutResult(TransactionStatus status) throws ResourceAllocationException {
         
                 Account account = _accountDao.lockRow(vm.getAccountId(), true);
         
@@ -1473,10 +1474,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
                 //Update Resource Count for the given account
                 resourceCountIncrement(account.getId(), new Long(serviceOffering.getCpu()),
                         new Long(serviceOffering.getRamSize()));
-                
-                return null;
             }
-        }, ResourceAllocationException.class);
+        });
 
 
         return _vmDao.findById(vmId);
@@ -2785,7 +2784,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
             final ServiceOfferingVO offering, final boolean isIso, final String sshPublicKey,
             final LinkedHashMap<String, NicProfile> networkNicMap, final long id, final String instanceName, final String uuidName,
             final HypervisorType hypervisorType) throws InsufficientCapacityException {
-        return Transaction.executeWithException(new TransactionCallbackWithException<UserVmVO>() {
+        return Transaction.execute(new TransactionCallbackWithException<UserVmVO,InsufficientCapacityException>() {
             @Override
             public UserVmVO doInTransaction(TransactionStatus status) throws InsufficientCapacityException {
                 UserVmVO vm = new UserVmVO(id, instanceName, displayName,
@@ -2878,7 +2877,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
                         new Long(offering.getRamSize()));
                 return vm;
             }
-        }, InsufficientCapacityException.class);
+        });
     }
 
     private void validateUserData(String userData, HTTPMethod httpmethod) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java b/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java
index 18f17b8..cd064f5 100644
--- a/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java
+++ b/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java
@@ -92,6 +92,7 @@ import com.cloud.utils.db.Transaction;
 import com.cloud.utils.db.TransactionCallback;
 import com.cloud.utils.db.TransactionCallbackNoReturn;
 import com.cloud.utils.db.TransactionCallbackWithException;
+import com.cloud.utils.db.TransactionCallbackWithExceptionNoReturn;
 import com.cloud.utils.db.TransactionStatus;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.fsm.NoTransitionException;
@@ -487,9 +488,9 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana
     @DB
     protected void processAnswer(final VMSnapshotVO vmSnapshot, UserVmVO  userVm, final Answer as, Long hostId) {
         try {
-            Transaction.executeWithException(new TransactionCallbackWithException<Object>() {
+            Transaction.execute(new TransactionCallbackWithExceptionNoReturn<NoTransitionException>() {
                 @Override
-                public Object doInTransaction(TransactionStatus status) throws NoTransitionException {
+                public void doInTransactionWithoutResult(TransactionStatus status) throws NoTransitionException {
                     if (as instanceof CreateVMSnapshotAnswer) {
                         CreateVMSnapshotAnswer answer = (CreateVMSnapshotAnswer) as;
                         finalizeCreate(vmSnapshot, answer.getVolumeTOs());
@@ -503,10 +504,8 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana
                         finalizeDelete(vmSnapshot, answer.getVolumeTOs());
                         _vmSnapshotDao.remove(vmSnapshot.getId());
                     }
-                    
-                    return null;
                 }
-            }, NoTransitionException.class);
+            });
         } catch (Exception e) {
             String errMsg = "Error while process answer: " + as.getClass() + " due to " + e.getMessage();
             s_logger.error(errMsg, e);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edeaf981/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java b/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
index 1149085..e2d33ac 100644
--- a/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
+++ b/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
@@ -71,7 +71,6 @@ import com.cloud.utils.db.JoinBuilder;
 import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria;
 import com.cloud.utils.db.Transaction;
-import com.cloud.utils.db.TransactionCallback;
 import com.cloud.utils.db.TransactionCallbackWithException;
 import com.cloud.utils.db.TransactionStatus;
 import com.cloud.utils.exception.CloudRuntimeException;
@@ -162,7 +161,7 @@ public class ApplicationLoadBalancerManagerImpl extends ManagerBase implements A
         boolean success = true;
         ApplicationLoadBalancerRuleVO newRule = null;
         try {
-            newRule = Transaction.executeWithException(new TransactionCallbackWithException<ApplicationLoadBalancerRuleVO>() {
+            newRule = Transaction.execute(new TransactionCallbackWithException<ApplicationLoadBalancerRuleVO,NetworkRuleConflictException>() {
                 @Override
                 public ApplicationLoadBalancerRuleVO doInTransaction(TransactionStatus status) throws NetworkRuleConflictException {
                     //1) Persist the rule
@@ -183,7 +182,7 @@ public class ApplicationLoadBalancerManagerImpl extends ManagerBase implements A
                     
                     return newRule;
                 }
-            }, NetworkRuleConflictException.class);
+            });
             
             return newRule;
         } catch (Exception e) {


Mime
View raw message