/// <summary>
 /// Rollback transaction.
 /// </summary>
 /// <param name="tx">Transaction.</param>
 /// <returns>Final transaction state.</returns>
 internal TransactionState TxRollback(TransactionImpl tx)
 {
     return (TransactionState)UU.TransactionsRollback(Target, tx.Id);
 }
 /// <summary>
 /// Close transaction.
 /// </summary>
 /// <param name="tx">Transaction.</param>
 /// <returns>Final transaction state.</returns>
 internal int TxClose(TransactionImpl tx)
 {
     return UU.TransactionsClose(Target, tx.Id);
 }
Beispiel #3
0
 /// <summary>
 /// Rolls tx back in async mode.
 /// </summary>
 internal Task RollbackAsync(TransactionImpl tx)
 {
     return DoOutOpAsync(OpRollbackAsync, w => w.WriteLong(tx.Id));
 }
 /// <summary>
 /// Commit transaction.
 /// </summary>
 /// <param name="tx">Transaction.</param>
 /// <returns>Final transaction state.</returns>
 internal TransactionState TxCommit(TransactionImpl tx)
 {
     return (TransactionState) UU.TransactionsCommit(Target, tx.Id);
 }
        internal Task<IEnumerable<object>> ReadEventsFromJournal(TransactionImpl transaction, Offset offset)
        {
            var request = ReadJournalRequest.Create(transaction.Name, offset, transaction.JournalSize,
                nextRequestUID(), transaction.WorkerUID);
            var tcs = new TaskCompletionSource<IEnumerable<object>>();

            mapper.Add(request.Header.RequestUID, (response) =>
            {
                var r = (ReadJournalResponse)response.Body;
                var events = r.Events.Select(evt => serializer.ConvertFromString(evt.Data) );
                snapshotManager.ForEach(m => m.SaveSnapshot(transaction.Name, new SnapshotEntry(r.Bytes, r.Events)) );
                tcs.SetResult(events);
            }, (failure) =>
            {
                tcs.SetException(failure);
            });

            requests.Add(request, cancellationToken.Token);
            return tcs.Task;
        }
Beispiel #6
0
 /// <summary>
 /// Commits tx in async mode.
 /// </summary>
 internal Task CommitAsync(TransactionImpl tx)
 {
     return DoOutOpAsync(OpCommitAsync, w => w.WriteLong(tx.Id));
 }
Beispiel #7
0
 /// <summary>
 /// Close transaction.
 /// </summary>
 /// <param name="tx">Transaction.</param>
 /// <returns>Final transaction state.</returns>
 internal int TxClose(TransactionImpl tx)
 {
     return (int) DoOutInOp(OpClose, tx.Id);
 }
 /// <summary>
 /// Rolls tx back in async mode.
 /// </summary>
 internal Task RollbackAsync(TransactionImpl tx)
 {
     return GetFuture<object>((futId, futTyp) => UU.TransactionsRollbackAsync(Target, tx.Id, futId)).Task;
 }
Beispiel #9
0
 /// <summary>
 /// Commit transaction.
 /// </summary>
 /// <param name="tx">Transaction.</param>
 /// <returns>Final transaction state.</returns>
 internal TransactionState TxCommit(TransactionImpl tx)
 {
     return (TransactionState) DoOutInOp(OpCommit, tx.Id);
 }
Beispiel #10
0
 /// <summary>
 /// Rollback transaction.
 /// </summary>
 /// <param name="tx">Transaction.</param>
 /// <returns>Final transaction state.</returns>
 internal TransactionState TxRollback(TransactionImpl tx)
 {
     return (TransactionState) DoOutInOp(OpRollback, tx.Id);
 }
Beispiel #11
0
        public ITransaction TxStart(TransactionConcurrency concurrency, TransactionIsolation isolation,
            TimeSpan timeout, int txSize)
        {
            var id = DoOutInOp(OpStart, w =>
            {
                w.WriteInt((int) concurrency);
                w.WriteInt((int) isolation);
                w.WriteTimeSpanAsLong(timeout);
                w.WriteInt(txSize);
            }, s => s.ReadLong());

            var innerTx = new TransactionImpl(id, this, concurrency, isolation, timeout, _localNodeId);
            
            return new Transaction(innerTx);
        }
Beispiel #12
0
        protected internal virtual void DoRegisterTypes(ModelBuilder bpmnModelBuilder)
        {
            ActivationConditionImpl.RegisterType(bpmnModelBuilder);
            ActivityImpl.RegisterType(bpmnModelBuilder);
            ArtifactImpl.RegisterType(bpmnModelBuilder);
            AssignmentImpl.RegisterType(bpmnModelBuilder);
            AssociationImpl.RegisterType(bpmnModelBuilder);
            AuditingImpl.RegisterType(bpmnModelBuilder);
            BaseElementImpl.RegisterType(bpmnModelBuilder);
            BoundaryEventImpl.RegisterType(bpmnModelBuilder);
            BusinessRuleTaskImpl.RegisterType(bpmnModelBuilder);
            CallableElementImpl.RegisterType(bpmnModelBuilder);
            CallActivityImpl.RegisterType(bpmnModelBuilder);
            CallConversationImpl.RegisterType(bpmnModelBuilder);
            CancelEventDefinitionImpl.RegisterType(bpmnModelBuilder);
            CatchEventImpl.RegisterType(bpmnModelBuilder);
            CategoryValueImpl.RegisterType(bpmnModelBuilder);
            CategoryValueRef.RegisterType(bpmnModelBuilder);
            ChildLaneSet.RegisterType(bpmnModelBuilder);
            CollaborationImpl.RegisterType(bpmnModelBuilder);
            CompensateEventDefinitionImpl.RegisterType(bpmnModelBuilder);
            ConditionImpl.RegisterType(bpmnModelBuilder);
            ConditionalEventDefinitionImpl.RegisterType(bpmnModelBuilder);
            CompletionConditionImpl.RegisterType(bpmnModelBuilder);
            ComplexBehaviorDefinitionImpl.RegisterType(bpmnModelBuilder);
            ComplexGatewayImpl.RegisterType(bpmnModelBuilder);
            ConditionExpressionImpl.RegisterType(bpmnModelBuilder);
            ConversationAssociationImpl.RegisterType(bpmnModelBuilder);
            ConversationImpl.RegisterType(bpmnModelBuilder);
            ConversationLinkImpl.RegisterType(bpmnModelBuilder);
            ConversationNodeImpl.RegisterType(bpmnModelBuilder);
            CorrelationKeyImpl.RegisterType(bpmnModelBuilder);
            CorrelationPropertyBindingImpl.RegisterType(bpmnModelBuilder);
            CorrelationPropertyImpl.RegisterType(bpmnModelBuilder);
            CorrelationPropertyRef.RegisterType(bpmnModelBuilder);
            CorrelationPropertyRetrievalExpressionImpl.RegisterType(bpmnModelBuilder);
            CorrelationSubscriptionImpl.RegisterType(bpmnModelBuilder);
            DataAssociationImpl.RegisterType(bpmnModelBuilder);
            DataInputAssociationImpl.RegisterType(bpmnModelBuilder);
            DataInputImpl.RegisterType(bpmnModelBuilder);
            DataInputRefs.RegisterType(bpmnModelBuilder);
            DataOutputAssociationImpl.RegisterType(bpmnModelBuilder);
            DataOutputImpl.RegisterType(bpmnModelBuilder);
            DataOutputRefs.RegisterType(bpmnModelBuilder);
            DataPath.RegisterType(bpmnModelBuilder);
            DataStateImpl.RegisterType(bpmnModelBuilder);
            DataObjectImpl.RegisterType(bpmnModelBuilder);
            DataObjectReferenceImpl.RegisterType(bpmnModelBuilder);
            DataStoreImpl.RegisterType(bpmnModelBuilder);
            DefinitionsImpl.RegisterType(bpmnModelBuilder);
            DocumentationImpl.RegisterType(bpmnModelBuilder);
            EndEventImpl.RegisterType(bpmnModelBuilder);
            EndPointImpl.RegisterType(bpmnModelBuilder);
            EndPointRef.RegisterType(bpmnModelBuilder);
            ErrorEventDefinitionImpl.RegisterType(bpmnModelBuilder);
            ErrorImpl.RegisterType(bpmnModelBuilder);
            ErrorRef.RegisterType(bpmnModelBuilder);
            EscalationImpl.RegisterType(bpmnModelBuilder);
            EscalationEventDefinitionImpl.RegisterType(bpmnModelBuilder);
            EventBasedGatewayImpl.RegisterType(bpmnModelBuilder);
            EventDefinitionImpl.RegisterType(bpmnModelBuilder);
            EventDefinitionRef.RegisterType(bpmnModelBuilder);
            EventImpl.RegisterType(bpmnModelBuilder);
            ExclusiveGatewayImpl.RegisterType(bpmnModelBuilder);
            ExpressionImpl.RegisterType(bpmnModelBuilder);
            ExtensionElementsImpl.RegisterType(bpmnModelBuilder);
            ExtensionImpl.RegisterType(bpmnModelBuilder);
            FlowElementImpl.RegisterType(bpmnModelBuilder);
            FlowNodeImpl.RegisterType(bpmnModelBuilder);
            FlowNodeRef.RegisterType(bpmnModelBuilder);
            FormalExpressionImpl.RegisterType(bpmnModelBuilder);
            From.RegisterType(bpmnModelBuilder);
            GatewayImpl.RegisterType(bpmnModelBuilder);
            GlobalConversationImpl.RegisterType(bpmnModelBuilder);
            HumanPerformerImpl.RegisterType(bpmnModelBuilder);
            ImportImpl.RegisterType(bpmnModelBuilder);
            InclusiveGatewayImpl.RegisterType(bpmnModelBuilder);
            Incoming.RegisterType(bpmnModelBuilder);
            InMessageRef.RegisterType(bpmnModelBuilder);
            InnerParticipantRef.RegisterType(bpmnModelBuilder);
            InputDataItemImpl.RegisterType(bpmnModelBuilder);
            InputSetImpl.RegisterType(bpmnModelBuilder);
            InputSetRefs.RegisterType(bpmnModelBuilder);
            InteractionNodeImpl.RegisterType(bpmnModelBuilder);
            InterfaceImpl.RegisterType(bpmnModelBuilder);
            InterfaceRef.RegisterType(bpmnModelBuilder);
            IntermediateCatchEventImpl.RegisterType(bpmnModelBuilder);
            IntermediateThrowEventImpl.RegisterType(bpmnModelBuilder);
            IoBindingImpl.RegisterType(bpmnModelBuilder);
            IoSpecificationImpl.RegisterType(bpmnModelBuilder);
            ItemAwareElementImpl.RegisterType(bpmnModelBuilder);
            ItemDefinitionImpl.RegisterType(bpmnModelBuilder);
            LaneImpl.RegisterType(bpmnModelBuilder);
            LaneSetImpl.RegisterType(bpmnModelBuilder);
            LinkEventDefinitionImpl.RegisterType(bpmnModelBuilder);
            LoopCardinalityImpl.RegisterType(bpmnModelBuilder);
            LoopCharacteristicsImpl.RegisterType(bpmnModelBuilder);
            LoopDataInputRef.RegisterType(bpmnModelBuilder);
            LoopDataOutputRef.RegisterType(bpmnModelBuilder);
            ManualTaskImpl.RegisterType(bpmnModelBuilder);
            MessageEventDefinitionImpl.RegisterType(bpmnModelBuilder);
            MessageFlowAssociationImpl.RegisterType(bpmnModelBuilder);
            MessageFlowImpl.RegisterType(bpmnModelBuilder);
            MessageFlowRef.RegisterType(bpmnModelBuilder);
            MessageImpl.RegisterType(bpmnModelBuilder);
            MessagePath.RegisterType(bpmnModelBuilder);
            ModelElementInstanceImpl.RegisterType(bpmnModelBuilder);
            MonitoringImpl.RegisterType(bpmnModelBuilder);
            MultiInstanceLoopCharacteristicsImpl.RegisterType(bpmnModelBuilder);
            OperationImpl.RegisterType(bpmnModelBuilder);
            OperationRef.RegisterType(bpmnModelBuilder);
            OptionalInputRefs.RegisterType(bpmnModelBuilder);
            OptionalOutputRefs.RegisterType(bpmnModelBuilder);
            OuterParticipantRef.RegisterType(bpmnModelBuilder);
            OutMessageRef.RegisterType(bpmnModelBuilder);
            Outgoing.RegisterType(bpmnModelBuilder);
            OutputDataItemImpl.RegisterType(bpmnModelBuilder);
            OutputSetImpl.RegisterType(bpmnModelBuilder);
            OutputSetRefs.RegisterType(bpmnModelBuilder);
            ParallelGatewayImpl.RegisterType(bpmnModelBuilder);
            ParticipantAssociationImpl.RegisterType(bpmnModelBuilder);
            ParticipantImpl.RegisterType(bpmnModelBuilder);
            ParticipantMultiplicityImpl.RegisterType(bpmnModelBuilder);
            ParticipantRef.RegisterType(bpmnModelBuilder);
            PartitionElement.RegisterType(bpmnModelBuilder);
            PerformerImpl.RegisterType(bpmnModelBuilder);
            PotentialOwnerImpl.RegisterType(bpmnModelBuilder);
            ProcessImpl.RegisterType(bpmnModelBuilder);
            PropertyImpl.RegisterType(bpmnModelBuilder);
            ReceiveTaskImpl.RegisterType(bpmnModelBuilder);
            RelationshipImpl.RegisterType(bpmnModelBuilder);
            RenderingImpl.RegisterType(bpmnModelBuilder);
            ResourceAssignmentExpressionImpl.RegisterType(bpmnModelBuilder);
            ResourceImpl.RegisterType(bpmnModelBuilder);
            ResourceParameterBindingImpl.RegisterType(bpmnModelBuilder);
            ResourceParameterImpl.RegisterType(bpmnModelBuilder);
            ResourceRef.RegisterType(bpmnModelBuilder);
            ResourceRoleImpl.RegisterType(bpmnModelBuilder);
            RootElementImpl.RegisterType(bpmnModelBuilder);
            ScriptImpl.RegisterType(bpmnModelBuilder);
            ScriptTaskImpl.RegisterType(bpmnModelBuilder);
            SendTaskImpl.RegisterType(bpmnModelBuilder);
            SequenceFlowImpl.RegisterType(bpmnModelBuilder);
            ServiceTaskImpl.RegisterType(bpmnModelBuilder);
            SignalEventDefinitionImpl.RegisterType(bpmnModelBuilder);
            SignalImpl.RegisterType(bpmnModelBuilder);
            Source.RegisterType(bpmnModelBuilder);
            SourceRef.RegisterType(bpmnModelBuilder);
            StartEventImpl.RegisterType(bpmnModelBuilder);
            SubConversationImpl.RegisterType(bpmnModelBuilder);
            SubProcessImpl.RegisterType(bpmnModelBuilder);
            SupportedInterfaceRef.RegisterType(bpmnModelBuilder);
            Supports.RegisterType(bpmnModelBuilder);
            Target.RegisterType(bpmnModelBuilder);
            TargetRef.RegisterType(bpmnModelBuilder);
            TaskImpl.RegisterType(bpmnModelBuilder);
            TerminateEventDefinitionImpl.RegisterType(bpmnModelBuilder);
            TextImpl.RegisterType(bpmnModelBuilder);
            TextAnnotationImpl.RegisterType(bpmnModelBuilder);
            ThrowEventImpl.RegisterType(bpmnModelBuilder);
            TimeCycleImpl.RegisterType(bpmnModelBuilder);
            TimeDateImpl.RegisterType(bpmnModelBuilder);
            TimeDurationImpl.RegisterType(bpmnModelBuilder);
            TimerEventDefinitionImpl.RegisterType(bpmnModelBuilder);
            To.RegisterType(bpmnModelBuilder);
            TransactionImpl.RegisterType(bpmnModelBuilder);
            Transformation.RegisterType(bpmnModelBuilder);
            UserTaskImpl.RegisterType(bpmnModelBuilder);
            WhileExecutingInputRefs.RegisterType(bpmnModelBuilder);
            WhileExecutingOutputRefs.RegisterType(bpmnModelBuilder);

            // DC
            FontImpl.RegisterType(bpmnModelBuilder);
            PointImpl.RegisterType(bpmnModelBuilder);
            BoundsImpl.RegisterType(bpmnModelBuilder);

            // DI
            DiagramImpl.RegisterType(bpmnModelBuilder);
            DiagramElementImpl.RegisterType(bpmnModelBuilder);
            EdgeImpl.RegisterType(bpmnModelBuilder);
            impl.instance.di.ExtensionImpl.RegisterType(bpmnModelBuilder);
            LabelImpl.RegisterType(bpmnModelBuilder);
            LabeledEdgeImpl.RegisterType(bpmnModelBuilder);
            LabeledShapeImpl.RegisterType(bpmnModelBuilder);
            NodeImpl.RegisterType(bpmnModelBuilder);
            PlaneImpl.RegisterType(bpmnModelBuilder);
            ShapeImpl.RegisterType(bpmnModelBuilder);
            StyleImpl.RegisterType(bpmnModelBuilder);
            WaypointImpl.RegisterType(bpmnModelBuilder);

            // BPMNDI
            BpmnDiagramImpl.RegisterType(bpmnModelBuilder);
            BpmnEdgeImpl.RegisterType(bpmnModelBuilder);
            BpmnLabelImpl.RegisterType(bpmnModelBuilder);
            BpmnLabelStyleImpl.RegisterType(bpmnModelBuilder);
            BpmnPlaneImpl.RegisterType(bpmnModelBuilder);
            BpmnShapeImpl.RegisterType(bpmnModelBuilder);

            // camunda extensions
            CamundaConnectorImpl.RegisterType(bpmnModelBuilder);
            CamundaConnectorIdImpl.RegisterType(bpmnModelBuilder);
            CamundaConstraintImpl.RegisterType(bpmnModelBuilder);
            CamundaEntryImpl.RegisterType(bpmnModelBuilder);
            CamundaExecutionListenerImpl.RegisterType(bpmnModelBuilder);
            CamundaExpressionImpl.RegisterType(bpmnModelBuilder);
            CamundaFailedJobRetryTimeCycleImpl.RegisterType(bpmnModelBuilder);
            CamundaFieldImpl.RegisterType(bpmnModelBuilder);
            CamundaFormDataImpl.RegisterType(bpmnModelBuilder);
            CamundaFormFieldImpl.RegisterType(bpmnModelBuilder);
            CamundaFormPropertyImpl.RegisterType(bpmnModelBuilder);
            CamundaInImpl.RegisterType(bpmnModelBuilder);
            CamundaInputOutputImpl.RegisterType(bpmnModelBuilder);
            CamundaInputParameterImpl.RegisterType(bpmnModelBuilder);
            CamundaListImpl.RegisterType(bpmnModelBuilder);
            CamundaMapImpl.RegisterType(bpmnModelBuilder);
            CamundaOutputParameterImpl.RegisterType(bpmnModelBuilder);
            CamundaOutImpl.RegisterType(bpmnModelBuilder);
            CamundaPotentialStarterImpl.RegisterType(bpmnModelBuilder);
            CamundaPropertiesImpl.RegisterType(bpmnModelBuilder);
            CamundaPropertyImpl.RegisterType(bpmnModelBuilder);
            CamundaScriptImpl.RegisterType(bpmnModelBuilder);
            CamundaStringImpl.RegisterType(bpmnModelBuilder);
            CamundaTaskListenerImpl.RegisterType(bpmnModelBuilder);
            CamundaValidationImpl.RegisterType(bpmnModelBuilder);
            CamundaValueImpl.RegisterType(bpmnModelBuilder);
        }
        internal Task<ICommitResult> CommitEvents(TransactionImpl transaction, List<object> events)
        {
            var request = CommitTransactionPreRequest.Create(new List<object>(events), transaction.Name, transaction.TransactionUID,
                nextRequestUID(), transaction.WorkerUID);
            var tcs = new TaskCompletionSource<ICommitResult>();

            mapper.Add(request.Header.RequestUID, (response) =>
            {
                var r = (CommitTransactionResponse)response.Body;
                ICommitResult result;
                if (r.Success)
                    result = new CommitSuccess();
                else
                    result = new CommitFailed(events, r.JournalSize);
                tcs.SetResult(result);
            }, (failure) =>
            {
                tcs.SetException(failure);
            });

            requests.Add(request, cancellationToken.Token);
            return tcs.Task;
        }
 /// <summary>
 /// Get transaction current state.
 /// </summary>
 /// <param name="tx">Transaction.</param>
 /// <returns>Transaction current state.</returns>
 internal TransactionState TxState(TransactionImpl tx)
 {
     return GetTransactionState(UU.TransactionsState(Target, tx.Id));
 }
Beispiel #15
0
 /// <summary>
 /// Get transaction current state.
 /// </summary>
 /// <param name="tx">Transaction.</param>
 /// <returns>Transaction current state.</returns>
 internal TransactionState TxState(TransactionImpl tx)
 {
     return (TransactionState) DoOutInOp(OpState, tx.Id);
 }
 /// <summary>
 /// Set transaction rollback-only flag.
 /// </summary>
 /// <param name="tx">Transaction.</param>
 /// <returns><c>true</c> if the flag was set.</returns>
 internal bool TxSetRollbackOnly(TransactionImpl tx)
 {
     return UU.TransactionsSetRollbackOnly(Target, tx.Id);
 }
Beispiel #17
0
 /// <summary>
 /// Set transaction rollback-only flag.
 /// </summary>
 /// <param name="tx">Transaction.</param>
 /// <returns><c>true</c> if the flag was set.</returns>
 internal bool TxSetRollbackOnly(TransactionImpl tx)
 {
     return DoOutInOp(OpSetRollbackOnly, tx.Id) == True;
 }
        /** <inheritDoc /> */
        public ITransaction TxStart(TransactionConcurrency concurrency, TransactionIsolation isolation,
            TimeSpan timeout, int txSize)
        {
            var id = UU.TransactionsStart(Target, (int)concurrency, (int)isolation, (long)timeout.TotalMilliseconds,
                txSize);

            var innerTx = new TransactionImpl(id, this, concurrency, isolation, timeout, _localNodeId);
            
            return new Transaction(innerTx);
        }
        internal Task<ITransaction> OpenTransaction(string name)
        {
            var request = NewTransactionRequest.Create(name, nextRequestUID());
            var tcs = new TaskCompletionSource<ITransaction>();

            mapper.Add(request.Header.RequestUID, (response) => {
                var r = (NewTransactionResponse)response.Body;
                var transaction = new TransactionImpl(dataStorage, name, r.JournalSize,
                    response.Header.WorkerUID, r.TransactionUID);
                tcs.SetResult(transaction);
            }, (failure) => {
                tcs.SetException(failure);
            });

            requests.Add(request, cancellationToken.Token);
            return tcs.Task;
        }