private void stopEquipments(final Collection<Long> equipmentIds,final Timestamp timestamp,final String message){
  Equipment currentEquipmentCopy;
  for (  Long equipmentId : equipmentIds) {
    try {
      try {
        currentEquipmentCopy=equipmentCache.getCopy(equipmentId);
        equipmentFacade.stop(equipmentId,timestamp);
        stopStateTag(currentEquipmentCopy.getStateTagId(),timestamp,message);
        for (        Long subId : currentEquipmentCopy.getSubEquipmentIds()) {
          try {
            SubEquipment subEquipmentCopy=subEquipmentCache.getCopy(subId);
            stopStateTag(subEquipmentCopy.getStateTagId(),timestamp,message);
            subEquipmentFacade.stop(subId,timestamp);
          }
 catch (          CacheElementNotFoundException ex) {
            LOGGER.error("Subequipment could not be retrieved from cache - unable to update Subequipment state.",ex);
          }
        }
      }
 catch (      CacheElementNotFoundException e) {
        LOGGER.error("Equipment could not be retrieved from cache - unable to update Equipment state.",e);
      }
    }
 catch (    Exception e) {
      LOGGER.error("Unable to acquire lock on Equipment/SubEquipment object",e);
    }
  }
}

private void stopEquipments ( final Collection < Long > equipmentIds , final Timestamp timestamp , final String message ) { Equipment currentEquipmentCopy ; for ( Long equipmentId : equipmentIds ) { try { try { currentEquipmentCopy = equipmentCache . getCopy ( equipmentId ) ; equipmentFacade . stop ( equipmentId , timestamp ) ; stopStateTag ( currentEquipmentCopy . getStateTagId ( ) , timestamp , message ) ; for ( Long subId : currentEquipmentCopy . getSubEquipmentIds ( ) ) { try { SubEquipment subEquipmentCopy = subEquipmentCache . getCopy ( subId ) ; stopStateTag ( subEquipmentCopy . getStateTagId ( ) , timestamp , message ) ; subEquipmentFacade . stop ( subId , timestamp ) ; } catch ( CacheElementNotFoundException ex ) { LOGGER . error ( "Subequipment could not be retrieved from cache - unable to update Subequipment state." , ex ) ; } } } catch ( CacheElementNotFoundException e ) { LOGGER . error ( "Equipment could not be retrieved from cache - unable to update Equipment state." , e ) ; } } catch ( Exception e ) { LOGGER . error ( "Unable to acquire lock on Equipment/SubEquipment object" , e ) ; } } }
stops equipments and subequipments linked to this process ( updates the cache objects & state tags ) . called on daq disconnection ( not alive expiry ) .
