Source:
public void create(final String identifier, final ServerSideConfiguration config) throws EntityAlreadyExistsException, EhcacheEntityCreationException, EntityBusyException, TimeoutException { Hold existingMaintenance = maintenanceHolds.get(identifier); Hold localMaintenance = null; if (existingMaintenance == null) { localMaintenance = createAccessLockFor(identifier).tryWriteLock(); } if (existingMaintenance == null && localMaintenance == null) { throw new EntityBusyException("Unable to create clustered tier manager for id " + identifier + ": another client owns the maintenance lease"); } EntityRef<EhcacheClientEntity, UUID> ref = getEntityRef(identifier); try { while (true) { ref.create(UUID.randomUUID()); try { EhcacheClientEntity entity = ref.fetchEntity(); try { entity.setTimeouts(entityTimeouts); entity.configure(config); break; } finally { entity.close(); } } catch (ClusteredTierManagerConfigurationException e) { try { ref.destroy(); } catch (EntityNotFoundException f) { } throw new EhcacheEntityCreationException("Unable to configure clustered tier manager for id " + identifier, e); } catch (EntityNotFoundException e) { } } } catch (EntityNotProvidedException e) { LOGGER.error("Unable to create clustered tier manager for id {}", identifier, e); silentlyUnlock(localMaintenance, identifier); throw new AssertionError(e); } catch (EntityVersionMismatchException e) { LOGGER.error("Unable to create clustered tier manager for id {}", identifier, e); silentlyUnlock(localMaintenance, identifier); throw new AssertionError(e); } catch(EntityAlreadyExistsException e) { silentlyUnlock(localMaintenance, identifier); throw e; } catch(EhcacheEntityCreationException e) { silentlyUnlock(localMaintenance, identifier); throw e; } catch(TimeoutException e) { silentlyUnlock(localMaintenance, identifier); throw e; } catch (Error e) { silentlyUnlock(localMaintenance, identifier); throw e; } catch (RuntimeException e) { silentlyUnlock(localMaintenance, identifier); throw e; } if (localMaintenance != null) { localMaintenance.unlock(); } }

Target:
public void create(final String identifier, final ServerSideConfiguration config) throws EntityAlreadyExistsException, EhcacheEntityCreationException, EntityBusyException, TimeoutException { Hold existingMaintenance = maintenanceHolds.get(identifier); Hold localMaintenance = null; if (existingMaintenance == null) { localMaintenance = createAccessLockFor(identifier).tryWriteLock(); } if (existingMaintenance == null && localMaintenance == null) { throw new EntityBusyException("Unable to create clustered tier manager for id " + identifier + ": another client owns the maintenance lease"); } boolean finished = false; try { EntityRef<EhcacheClientEntity, UUID> ref = getEntityRef(identifier); try { while (true) { ref.create(UUID.randomUUID()); try { EhcacheClientEntity entity = ref.fetchEntity(); try { entity.setTimeouts(entityTimeouts); entity.configure(config); finished = true; return; } finally { if (finished) { entity.close(); } else { silentlyClose(entity, identifier); } } } catch (ClusteredTierManagerConfigurationException e) { try { ref.destroy(); } catch (EntityNotFoundException f) { } throw new EhcacheEntityCreationException("Unable to configure clustered tier manager for id " + identifier, e); } catch (EntityNotFoundException e) { } } } catch (EntityNotProvidedException e) { LOGGER.error("Unable to create clustered tier manager for id {}", identifier, e); throw new AssertionError(e); } catch (EntityVersionMismatchException e) { LOGGER.error("Unable to create clustered tier manager for id {}", identifier, e); throw new AssertionError(e); } } finally { if (localMaintenance != null) { if (finished) { localMaintenance.unlock(); } else { silentlyUnlock(localMaintenance, identifier); } } } }