I am running into a problem when I add the start/submit transaction code. Without these lines my code executes to completion. When I add these lines back, I get an error stating that the profile cannot be deleted because it is still attached to a virtual server. Has anyone else had problems with transaction ordering?
Code:
// Get the system session binding stub and start transaction management (F5 LTM versions 11.0 and up)
sysSessionStub = (SystemSessionBindingStub) new iControl.SystemSessionLocator().getSystemSessionPort(new java.net.URL(endpoint));
sysSessionStub.setTimeout(Globals.IDLE_TIMEOUT); sysSessionStub.set_transaction_timeout(Globals.SESSION_TRANSACTION_TIMEOUT); sysSessionStub.start_transaction();
createOrDeletePool(lblPoolStub, lblVirtServerStub, lblRuleStub, lblProfilePersistenceStub, argProps);
sysSessionStub.submit_transaction();
and ------------------------
else if (command.equals(Globals.DELETE_LLB_GROUP_CMD)) {
// If the pool does not exist, throw an error
if ( !PoolServices.doesPoolExist(poolIdStr, lblPoolStub) ) {
gLogger.error("Cannot delete service-pool name'" + poolIdStr + "' because it does not exist.");
throw new LbException(Globals.RET_CODE_NON_EXISTENT_POOL, "Cannot delete service-pool name'" + poolIdStr + "' because it does not exist."); }
// Get the name of the virtual server from the F5 associated with the pool to delete String virtServerName2Chk = VirtualServerServices.getVirtServerName(virtualIpAddr, virtualServerProtocol, lbPort, lblVirtServerStub);
// Remove the persistence profile from the virtual server and then from the F5 VirtualServerServices.removePersistenceProfile(virtServerName2Chk, profileName, lblVirtServerStub);
ProfilePersistenceServices.deletetePersistenceProfile(profileName, lblProfilePersistenceStub);
// Remove the pool's rule from the virtual server and then from the F5 VirtualServerServices.removeRule(virtServerName2Chk, ruleName, lblVirtServerStub); RuleServices.deleteRule(ruleName, lblRuleStub);
// If the virtual server no longer supports any active pools and it is one we created, remove the virtual server
if ( !VirtualServerServices.doesVirtServerHaveActivePools(virtServerName2Chk, lblVirtServerStub) && virtServerName2Chk.equalsIgnoreCase(virtServerName) ) {
VirtualServerServices.deleteVirtualServer(virtServerName2Chk, lblVirtServerStub);
}
// Delete the pool's monitor association from the F5 PoolServices.removeMonitorAssociation(poolIdStr, lblPoolStub) ;
// Lastly delete the pool from the F5
lblPoolStub.delete_pool(new String[]{poolIdStr});
} // END DELETE_LLB_GROUP_CMD