List of usage examples for java.util.concurrent Executors newSingleThreadExecutor
public static ExecutorService newSingleThreadExecutor()
From source file:com.cloud.network.vpc.VpcManagerImpl.java
@DB protected boolean deletePrivateGatewayFromTheDB(final PrivateGateway gateway) { // check if there are ips allocted in the network final long networkId = gateway.getNetworkId(); vpcTxCallable.setGateway(gateway);// w ww. java 2 s . c o m final ExecutorService txExecutor = Executors.newSingleThreadExecutor(); final Future<Boolean> futureResult = txExecutor.submit(vpcTxCallable); boolean deleteNetworkFinal; try { deleteNetworkFinal = futureResult.get(); if (deleteNetworkFinal) { final User callerUser = _accountMgr.getActiveUser(CallContext.current().getCallingUserId()); final Account owner = _accountMgr.getAccount(Account.ACCOUNT_ID_SYSTEM); final ReservationContext context = new ReservationContextImpl(null, null, callerUser, owner); _ntwkMgr.destroyNetwork(networkId, context, false); s_logger.debug("Deleted private network id=" + networkId); } } catch (final InterruptedException e) { s_logger.error("deletePrivateGatewayFromTheDB failed to delete network id " + networkId + "due to => ", e); } catch (final ExecutionException e) { s_logger.error("deletePrivateGatewayFromTheDB failed to delete network id " + networkId + "due to => ", e); } return true; }