Beispiel #1
0
        public virtual void Commit()
        {
            Log.DebugTransactionOperation("firing event committing...");

            FireTransactionEvent(TransactionJavaStatus.Committing);

            Log.DebugTransactionOperation("committing the persistence session...");
            //清空缓存
            //CommandContext.DbEntityCache.Clear();
            Log.LogDebug("StandaloneTransactionContext数据库保存----------UnitOfWork.Commit()", null);
            CommandContext.DbContext.SaveChanges();
            //PersistenceProvider.Commit();

            Log.DebugTransactionOperation("firing event committed...");

            FireTransactionEvent(TransactionJavaStatus.Committed);
        }
        public virtual object Execute(CommandContext commandContext)
        {
            EnsureUtil.EnsureNotNull("deploymentId", DeploymentId);

            foreach (ICommandChecker checker in commandContext.ProcessEngineConfiguration.CommandCheckers)
            {
                checker.CheckDeleteDeployment(DeploymentId);
            }

            IUserOperationLogManager logManager      = commandContext.OperationLogManager;
            IList <PropertyChange>   propertyChanges = new List <PropertyChange>()
            {
                new PropertyChange("cascade", null, Cascade)
            };

            logManager.LogDeploymentOperation(UserOperationLogEntryFields.OperationTypeDelete, DeploymentId, propertyChanges);

            commandContext.DeploymentManager.DeleteDeployment(DeploymentId, Cascade, SkipCustomListeners /*, skipIoMappings*/);

            IProcessApplicationReference processApplicationReference = Context.ProcessEngineConfiguration.ProcessApplicationManager.GetProcessApplicationForDeployment(DeploymentId);

            DeleteDeploymentFailListener listener = new DeleteDeploymentFailListener(DeploymentId, processApplicationReference /*, Context.ProcessEngineConfiguration.CommandExecutorTxRequiresNew*/);

            try
            {
                commandContext.RunWithoutAuthorization(() =>
                {
                    (new UnregisterProcessApplicationCmd(DeploymentId, false)).Execute(commandContext);
                    (new UnregisterDeploymentCmd(new List <string>()
                    {
                        DeploymentId
                    })).Execute(commandContext);
                });
            }
            finally
            {
                try
                {
                    commandContext.TransactionContext.AddTransactionListener(TransactionJavaStatus.RolledBack, listener);
                }
                catch (System.Exception)
                {
                    TxLog.DebugTransactionOperation("Could not register transaction synchronization. Probably the TX has already been rolled back by application code.");
                    listener.Execute(commandContext);
                }
            }


            return(null);
        }
Beispiel #3
0
        protected internal virtual void RegisterWithJobExecutor(CommandContext commandContext,
                                                                DeploymentEntity deployment)
        {
            try
            {
                (new RegisterDeploymentCmd(deployment.Id)).Execute(commandContext);
            }
            finally
            {
                DeploymentFailListener listener = new DeploymentFailListener(deployment.Id);

                try
                {
                    commandContext.TransactionContext.AddTransactionListener(TransactionJavaStatus.RolledBack, listener);
                }
                catch (System.Exception)
                {
                    TxLog.DebugTransactionOperation(
                        "Could not register transaction synchronization. Probably the TX has already been rolled back by application code.");
                    listener.Execute(commandContext);
                }
            }
        }