Exemple #1
0
        protected internal virtual void handleOptimisticLockingException(DbOperation dbOperation)
        {
            bool isHandled = false;

            if (optimisticLockingListeners != null)
            {
                foreach (OptimisticLockingListener optimisticLockingListener in optimisticLockingListeners)
                {
                    if (optimisticLockingListener.EntityType == null || optimisticLockingListener.EntityType.IsAssignableFrom(dbOperation.EntityType))
                    {
                        optimisticLockingListener.failedOperation(dbOperation);
                        isHandled = true;
                    }
                }
            }

            if (!isHandled && Context.ProcessEngineConfiguration.SkipHistoryOptimisticLockingExceptions)
            {
                DbEntity dbEntity = ((DbEntityOperation)dbOperation).Entity;
                if (dbEntity is HistoricEntity || isHistoricByteArray(dbEntity))
                {
                    isHandled = true;
                }
            }

            if (!isHandled)
            {
                throw LOG.concurrentUpdateDbEntityException(dbOperation);
            }
        }