cancel
Showing results for 
Search instead for 
Did you mean: 

Static member is set to null by the process engine

sor1
Champ in-the-making
Champ in-the-making
Hello,
I have a static member:
public final class MySingletonClass
{
    public static MyClass MyUniqueObject;
}
MyClass is a class extending the interface Com4jObject.

I need to use this static object in 2 service tasks of my workflow: the first service task create it and start to use it. The second service task also use it (and dispose it).
I cannot set this object as a process variable as it is not serializable (com object).
My problem is that my static object is randomly set to null before I try to access it in the second service task.

Why is this static member set to null and how would you do solve this problem?

Thanks.
11 REPLIES 11

jbarrez
Star Contributor
Star Contributor
Can you post the process xml, cause I don't quite follow what you are trying to do.
Also, can you included the code of your service tasks?

sor1
Champ in-the-making
Champ in-the-making
public class MyFirstServiceTaskDelegate extends JavaDelegate
{
    public void execute(DelegateExecution execution)
    {
        MyClass connection = new MyClass();
        connection.login("MyUserName");
        MySingletonClass.MyUniqueObject = connection;                                           
    }
}
public class MySecondServiceTaskDelegate extends JavaDelegate
{
    public void execute(DelegateExecution execution)
    {
        MySingletonClass.MyUniqueObject.logOff; // I have a java.lang.NullPointerException because MySingletonClass.MyUniqueObject is null!!
        MySingletonClass.MyUniqueObject.Dispose();
    }
}
The process:
<process id="sid-ecb59ae4-724e-4e3a-913d-4ba70efe620a" name="MyProcess" isExecutable="true">

        <startEvent id="StartEvent" name="Start">
            <documentation id="sid-c4a36fd8-83f9-49ad-ae93-e090c82e6cbd">Comment…
            </documentation>
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffff"/>
            </extensionElements>
            <outgoing>sid-43298455-F11D-464C-A804-9999D7A63A52</outgoing>
        </startEvent>
        <serviceTask activiti:class="com.persistent.greenlab.workflow.scheduler.ValidCommandComingDelegate" completionQuantity="1" id="ValidAnalysis" implementation="webService" isForCompensation="false" name="Valid analysis is coming" startQuantity="1">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffcc"/>
                <signavio:signavioMetaData metaKey="risklevel" metaValue=""/>
                <signavio:signavioMetaData metaKey="externaldocuments" metaValue="[]"/>
            </extensionElements>
            <incoming>sid-43298455-F11D-464C-A804-9999D7A63A52</incoming>
            <outgoing>sid-16330616-A681-4C50-A56E-0D7824FF9C55</outgoing>
        </serviceTask>
        <exclusiveGateway gatewayDirection="Diverging" id="IsValidCommand" name="Valid Command?">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffff"/>
            </extensionElements>
            <incoming>sid-16330616-A681-4C50-A56E-0D7824FF9C55</incoming>
            <outgoing>sid-442912D1-02D2-42A2-BDB4-D5ECBC843FFD</outgoing>
            <outgoing>sid-1A88D597-C65D-493F-BDE4-35B36CA3BB34</outgoing>
        </exclusiveGateway>
        <serviceTask activiti:class="com.persistent.greenlab.workflow.scheduler.InstrumentsCheckupDelegate" completionQuantity="1" id="InstrumentsCheckup" implementation="webService" isForCompensation="false" name="Instrument Checkup" startQuantity="1">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffcc"/>
                <signavio:signavioMetaData metaKey="risklevel" metaValue=""/>
                <signavio:signavioMetaData metaKey="externaldocuments" metaValue="[]"/>
            </extensionElements>
            <incoming>sid-BAF33379-610C-4603-8BE9-F61BDBDB3D49</incoming>
            <incoming>sid-442912D1-02D2-42A2-BDB4-D5ECBC843FFD</incoming>
            <incoming>sid-FF527D19-F32D-4D49-87C3-F638838885C2</incoming>
            <outgoing>sid-E5F8C44A-9D50-4054-A75A-03675C2A77BB</outgoing>
        </serviceTask>
        <receiveTask completionQuantity="1" id="MonitoringInstrumentStatusChange" implementation="webService" instantiate="false" isForCompensation="false" name="Monitoring Instrument status change (until priority = 1)" startQuantity="1">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffcc"/>
                <signavio:signavioMetaData metaKey="risklevel" metaValue=""/>
                <signavio:signavioMetaData metaKey="externaldocuments" metaValue="[]"/>
            </extensionElements>
            <incoming>sid-E405AE84-E015-4AB8-BFEB-502A804D39C9</incoming>
            <outgoing>sid-BAF33379-610C-4603-8BE9-F61BDBDB3D49</outgoing>
        </receiveTask>
        <serviceTask activiti:class="com.persistent.greenlab.workflow.scheduler.UpdateAnalysisStateToScheduledDelegate" completionQuantity="1" id="UpdateAnalysisStateToScheduled" implementation="webService" isForCompensation="false" name="Update analysis state to scheduled" startQuantity="1">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffcc"/>
                <signavio:signavioMetaData metaKey="risklevel" metaValue=""/>
                <signavio:signavioMetaData metaKey="externaldocuments" metaValue="[]"/>
            </extensionElements>
            <incoming>sid-0D2E4763-AFE9-46E2-BB78-9CEBB9914F7E</incoming>
            <outgoing>sid-E405AE84-E015-4AB8-BFEB-502A804D39C9</outgoing>
        </serviceTask>
        <exclusiveGateway gatewayDirection="Diverging" id="IsInstrumentInError" name="Instrument&#10;in error in Lab ?">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffff"/>
            </extensionElements>
            <incoming>sid-408E46D7-84BE-4D3E-A767-68F89091C695</incoming>
            <outgoing>sid-0D2E4763-AFE9-46E2-BB78-9CEBB9914F7E</outgoing>
            <outgoing>sid-7AF88DEA-00C9-40F8-9725-5DB1925388A1</outgoing>
        </exclusiveGateway>
        <exclusiveGateway gatewayDirection="Diverging" id="IsInstrumentIdlePriorityOrder1" name="Instrument Idle&#10;and&#10;Priority order =1">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffff"/>
            </extensionElements>
            <incoming>sid-E5F8C44A-9D50-4054-A75A-03675C2A77BB</incoming>
            <outgoing>sid-C917E421-F0E4-4F6D-A644-1A750404D45E</outgoing>
            <outgoing>sid-408E46D7-84BE-4D3E-A767-68F89091C695</outgoing>
        </exclusiveGateway>
        <serviceTask activiti:class="com.persistent.greenlab.workflow.scheduler.MyFirstServiceTaskDelegate" completionQuantity="1" id="StartAnalysis" implementation="webService" isForCompensation="false" name="MyFirstServiceTask" startQuantity="1">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffcc"/>
                <signavio:signavioMetaData metaKey="risklevel" metaValue=""/>
                <signavio:signavioMetaData metaKey="externaldocuments" metaValue="[]"/>
            </extensionElements>
            <incoming>sid-C917E421-F0E4-4F6D-A644-1A750404D45E</incoming>
            <outgoing>sid-D1E44199-7EB7-4A49-B104-6D6A9355838C</outgoing>
        </serviceTask>
        <parallelGateway gatewayDirection="Diverging" id="sid-CDB70F30-11B7-4936-917A-60C48CBB17D7" name="">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffff"/>
            </extensionElements>
            <incoming>sid-D1E44199-7EB7-4A49-B104-6D6A9355838C</incoming>
            <outgoing>sid-9A40CAAD-EA28-43D3-B0B6-89129321B64B</outgoing>
            <outgoing>sid-521E196C-F674-443B-8439-A6A4F873507C</outgoing>
        </parallelGateway>
        <serviceTask activiti:class="com.persistent.greenlab.workflow.scheduler.UpdateAnalysisStateToInProgressDelegate" completionQuantity="1" id="UpdateAnalysisStateToInProgress" implementation="webService" isForCompensation="false" name="Update analysis state to in progress" startQuantity="1">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffcc"/>
                <signavio:signavioMetaData metaKey="risklevel" metaValue=""/>
                <signavio:signavioMetaData metaKey="externaldocuments" metaValue="[]"/>
            </extensionElements>
            <incoming>sid-9A40CAAD-EA28-43D3-B0B6-89129321B64B</incoming>
            <outgoing>sid-25CA92FA-094F-4789-8932-887E6B7EF165</outgoing>
        </serviceTask>
        <parallelGateway gatewayDirection="Converging" id="sid-3B14D52E-5449-44B9-B344-68EB68793C39" name="">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffff"/>
            </extensionElements>
            <incoming>sid-BA416BE3-A5CD-4DA2-8006-90A43264F265</incoming>
            <incoming>sid-25CA92FA-094F-4789-8932-887E6B7EF165</incoming>
            <outgoing>sid-F79DE1A4-EFD9-44EF-87CE-8C662658DCA1</outgoing>
        </parallelGateway>
        <serviceTask activiti:class="com.persistent.greenlab.workflow.scheduler.UpdateInstrumentStatusToRunningDelegate" completionQuantity="1" id="UpdateInstrumentStatusIdlToRunning" implementation="webService" isForCompensation="false" name="Update intrument status from idle to running" startQuantity="1">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffcc"/>
                <signavio:signavioMetaData metaKey="risklevel" metaValue=""/>
                <signavio:signavioMetaData metaKey="externaldocuments" metaValue="[]"/>
            </extensionElements>
            <incoming>sid-521E196C-F674-443B-8439-A6A4F873507C</incoming>
            <outgoing>sid-BA416BE3-A5CD-4DA2-8006-90A43264F265</outgoing>
        </serviceTask>
        <serviceTask activiti:async="true" activiti:class="com.persistent.greenlab.workflow.scheduler.MonitoringAnalysisDelegate" completionQuantity="1" id="MonitoringAnalysis" implementation="webService" isForCompensation="false" name="Monitoring Analysis" startQuantity="1">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffcc"/>
                <signavio:signavioMetaData metaKey="risklevel" metaValue=""/>
                <signavio:signavioMetaData metaKey="externaldocuments" metaValue="[]"/>
            </extensionElements>
            <incoming>sid-F79DE1A4-EFD9-44EF-87CE-8C662658DCA1</incoming>
            <incoming>sid-C4543058-915D-45C9-A15C-5F27B4AD16E1</incoming>
            <outgoing>sid-E54E2C94-5D7C-485A-96C6-7D9E4228A7CB</outgoing>
        </serviceTask>
        <intermediateCatchEvent id="TimerWaitingEndOfRun" name="Waiting end of run">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffff"/>
            </extensionElements>
            <incoming>sid-A4EB997B-29B6-4590-B229-6EB28D010183</incoming>
            <outgoing>sid-C4543058-915D-45C9-A15C-5F27B4AD16E1</outgoing>
            <timerEventDefinition id="sid-6bc87052-3b45-4914-88b1-714fcfa104da">
                <timeDuration id="sid-2953e909-fb2e-4732-a092-a8b7715c1eba" xsi:type="tFormalExpression">${RunTime}</timeDuration>
            </timerEventDefinition>
        </intermediateCatchEvent>
        <exclusiveGateway gatewayDirection="Diverging" id="GateWayRunFinished" name="Run is finished?">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffff"/>
            </extensionElements>
            <incoming>sid-E54E2C94-5D7C-485A-96C6-7D9E4228A7CB</incoming>
            <outgoing>sid-A63C7EFD-8B52-45D8-A74C-074528E3CF24</outgoing>
            <outgoing>sid-A4EB997B-29B6-4590-B229-6EB28D010183</outgoing>
        </exclusiveGateway>
        <parallelGateway gatewayDirection="Diverging" id="sid-54E7C57C-4100-4318-9359-C398FC3FCDBD" name="">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffff"/>
            </extensionElements>
            <incoming>sid-A63C7EFD-8B52-45D8-A74C-074528E3CF24</incoming>
            <outgoing>sid-DFFBD589-C235-4A9E-AEFD-FEECEDB28D75</outgoing>
            <outgoing>sid-EA0D402C-EB86-481B-BD52-FF8D201E9F37</outgoing>
        </parallelGateway>
        <serviceTask activiti:class="com.persistent.greenlab.workflow.scheduler.MySecondServiceTaskDelegate" completionQuantity="1" id="UpdateInstrumentRunningToIdle" implementation="webService" isForCompensation="false" name="MySecondServiceTask" startQuantity="1">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffcc"/>
                <signavio:signavioMetaData metaKey="risklevel" metaValue=""/>
                <signavio:signavioMetaData metaKey="externaldocuments" metaValue="[]"/>
            </extensionElements>
            <incoming>sid-DFFBD589-C235-4A9E-AEFD-FEECEDB28D75</incoming>
            <outgoing>sid-73440689-B306-4AAA-8B5C-E865886AAAC5</outgoing>
        </serviceTask>
        <parallelGateway gatewayDirection="Converging" id="sid-270AAB82-043E-4B33-96F3-E8B09651C221" name="">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffff"/>
            </extensionElements>
            <incoming>sid-D7362764-2A68-4E45-843E-0450D6008B3D</incoming>
            <incoming>sid-73440689-B306-4AAA-8B5C-E865886AAAC5</incoming>
            <outgoing>sid-3294B7FF-FCB0-4A3B-8F06-9273A3C8F921</outgoing>
        </parallelGateway>
        <serviceTask activiti:class="com.persistent.greenlab.workflow.scheduler.UpdateAnalysisStateToEndedDelegate" completionQuantity="1" id="UpdateAnalysisStateInProgressToEnded" implementation="webService" isForCompensation="false" name="Update analysis state from in progress to ended" startQuantity="1">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffcc"/>
                <signavio:signavioMetaData metaKey="risklevel" metaValue=""/>
                <signavio:signavioMetaData metaKey="externaldocuments" metaValue="[]"/>
            </extensionElements>
            <incoming>sid-EA0D402C-EB86-481B-BD52-FF8D201E9F37</incoming>
            <outgoing>sid-D7362764-2A68-4E45-843E-0450D6008B3D</outgoing>
        </serviceTask>
        <endEvent id="EndEvent" name="End">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffff"/>
            </extensionElements>
            <incoming>sid-3294B7FF-FCB0-4A3B-8F06-9273A3C8F921</incoming>
        </endEvent>
        <parallelGateway gatewayDirection="Diverging" id="sid-6C7071D6-CE99-46D9-9D15-9D59E8C47118" name="">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffff"/>
            </extensionElements>
            <incoming>sid-7AF88DEA-00C9-40F8-9725-5DB1925388A1</incoming>
            <outgoing>sid-37FCF0E5-45E5-468B-A37F-9B9379C41B58</outgoing>
            <outgoing>sid-826DEFCA-04C2-4781-A783-3FE4CC0BF8A5</outgoing>
        </parallelGateway>
        <serviceTask activiti:class="com.persistent.greenlab.workflow.scheduler.UpdateIntrumentStatusToErrorDelegate" completionQuantity="1" id="UpdateIntrumentStatusToError" implementation="webService" isForCompensation="false" name="Update intrument status to error" startQuantity="1">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffcc"/>
                <signavio:signavioMetaData metaKey="risklevel" metaValue=""/>
                <signavio:signavioMetaData metaKey="externaldocuments" metaValue="[]"/>
            </extensionElements>
            <incoming>sid-37FCF0E5-45E5-468B-A37F-9B9379C41B58</incoming>
            <outgoing>sid-BD22C095-E7E8-48B3-A8B8-77D671C40354</outgoing>
        </serviceTask>
        <parallelGateway gatewayDirection="Converging" id="sid-2A87A051-E234-42DC-B153-6FFE5739D8AE" name="">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffff"/>
            </extensionElements>
            <incoming>sid-43EA876B-AE52-409A-B142-0349ABC27640</incoming>
            <incoming>sid-BD22C095-E7E8-48B3-A8B8-77D671C40354</incoming>
            <outgoing>sid-55B0D7CE-0A83-4D9C-94C0-6EADBC5F311A</outgoing>
        </parallelGateway>
        <serviceTask activiti:class="com.persistent.greenlab.workflow.scheduler.SendAnEmailDelegate" completionQuantity="1" id="sid-67D25F92-398D-4020-A0CD-BA527395F9B5" implementation="webService" isForCompensation="false" name="Send an e-mail" startQuantity="1">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffcc"/>
                <signavio:signavioMetaData metaKey="risklevel" metaValue=""/>
                <signavio:signavioMetaData metaKey="externaldocuments" metaValue="[]"/>
            </extensionElements>
            <incoming>sid-826DEFCA-04C2-4781-A783-3FE4CC0BF8A5</incoming>
            <outgoing>sid-43EA876B-AE52-409A-B142-0349ABC27640</outgoing>
        </serviceTask>
        <exclusiveGateway gatewayDirection="Diverging" id="IsThereAtLeastOneInstrumentOK" name="Is there one predefined &#10;instrument with a&#10;status not In Error?">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffff"/>
            </extensionElements>
            <incoming>sid-55B0D7CE-0A83-4D9C-94C0-6EADBC5F311A</incoming>
            <outgoing>sid-3DA1F847-D44C-4972-93B8-2E76F2D0E4F8</outgoing>
            <outgoing>sid-6E601F06-BBF8-4708-8EF0-4FD1D95C8A03</outgoing>
        </exclusiveGateway>
        <serviceTask activiti:class="com.persistent.greenlab.workflow.scheduler.AutomaticInstrumentSelectionAmongListDelegate" completionQuantity="1" id="AutomaticInstrumentSelection" implementation="webService" isForCompensation="false" name="Automatic Instrument selection among the list&#10;(less analyses in queue)&#10;" startQuantity="1">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffcc"/>
                <signavio:signavioMetaData metaKey="risklevel" metaValue=""/>
                <signavio:signavioMetaData metaKey="externaldocuments" metaValue="[]"/>
            </extensionElements>
            <incoming>sid-3DA1F847-D44C-4972-93B8-2E76F2D0E4F8</incoming>
            <outgoing>sid-06C49699-C486-4287-8753-6D4631760D1E</outgoing>
        </serviceTask>
        <userTask activiti:assignee="greenlab" completionQuantity="1" id="UserConfirmVial" implementation="webService" isForCompensation="false" name="Vial validation" startQuantity="1">
            <documentation id="sid-11623193-a6f4-4e85-a6b2-a9ce2c49e40c">Primary defined instrument is in error. Instrument used for analysis is: ${ChosenInstrumentName}. Please validate vial position on ${ChosenInstrumentName}.</documentation>
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffcc"/>
                <signavio:signavioMetaData metaKey="risklevel" metaValue=""/>
                <signavio:signavioMetaData metaKey="externaldocuments" metaValue="[]"/>
                <activiti:formProperty id="InstrumentName" name="Instrument Name" readable="true" required="false" type="string" variable="ChosenInstrumentName" writable="false"/>
                <activiti:formProperty id="VialNumber" name="Vial Number" readable="true" required="false" type="string" variable="VialNumber" writable="true"/>
            </extensionElements>
            <incoming>sid-06C49699-C486-4287-8753-6D4631760D1E</incoming>
            <outgoing>sid-CF3B924A-46FC-40E6-BC4A-285AE0CC9C4C</outgoing>
        </userTask>
        <exclusiveGateway gatewayDirection="Diverging" id="DoesUserContinue" name="">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffff"/>
            </extensionElements>
            <incoming>sid-CF3B924A-46FC-40E6-BC4A-285AE0CC9C4C</incoming>
            <outgoing>sid-615FBB43-F773-4701-9C35-5860E7AE10B2</outgoing>
            <outgoing>sid-FA00DF1B-6B7E-42F1-8439-AA2E62EAE606</outgoing>
        </exclusiveGateway>
        <serviceTask activiti:class="com.persistent.greenlab.workflow.scheduler.UpdateAnalysisStateToErrorDelegate" completionQuantity="1" id="UpdateAnalysisStateToError" implementation="webService" isForCompensation="false" name="Update Analysis state to Error and notify user" startQuantity="1">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffcc"/>
                <signavio:signavioMetaData metaKey="risklevel" metaValue=""/>
                <signavio:signavioMetaData metaKey="externaldocuments" metaValue="[]"/>
            </extensionElements>
            <incoming>sid-615FBB43-F773-4701-9C35-5860E7AE10B2</incoming>
            <incoming>sid-6E601F06-BBF8-4708-8EF0-4FD1D95C8A03</incoming>
            <outgoing>sid-41894BD6-0CAB-47DB-992F-1882A517AB9F</outgoing>
        </serviceTask>
        <endEvent id="EndEventError" name="End">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffff"/>
            </extensionElements>
            <incoming>sid-41894BD6-0CAB-47DB-992F-1882A517AB9F</incoming>
        </endEvent>
        <serviceTask activiti:class="com.persistent.greenlab.workflow.scheduler.UpdateXMLPartOtherInstrumentDelegate" completionQuantity="1" id="UpdateXMLPartOtherInstrument" implementation="webService" isForCompensation="false" name="Update XML (Other instrument)" startQuantity="1">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffcc"/>
                <signavio:signavioMetaData metaKey="risklevel" metaValue=""/>
                <signavio:signavioMetaData metaKey="externaldocuments" metaValue="[]"/>
            </extensionElements>
            <incoming>sid-FA00DF1B-6B7E-42F1-8439-AA2E62EAE606</incoming>
            <outgoing>sid-FF527D19-F32D-4D49-87C3-F638838885C2</outgoing>
        </serviceTask>
        <endEvent id="EndEventInvalidCommand" name="End">
            <extensionElements>
                <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffff"/>
            </extensionElements>
            <incoming>sid-1A88D597-C65D-493F-BDE4-35B36CA3BB34</incoming>
        </endEvent>
        <sequenceFlow id="sid-3294B7FF-FCB0-4A3B-8F06-9273A3C8F921" isImmediate="true" name="" sourceRef="sid-270AAB82-043E-4B33-96F3-E8B09651C221" targetRef="EndEvent"/>
        <sequenceFlow id="sid-43EA876B-AE52-409A-B142-0349ABC27640" isImmediate="true" name="" sourceRef="sid-67D25F92-398D-4020-A0CD-BA527395F9B5" targetRef="sid-2A87A051-E234-42DC-B153-6FFE5739D8AE"/>
        <sequenceFlow id="sid-D7362764-2A68-4E45-843E-0450D6008B3D" isImmediate="true" name="" sourceRef="UpdateAnalysisStateInProgressToEnded" targetRef="sid-270AAB82-043E-4B33-96F3-E8B09651C221"/>
        <sequenceFlow id="sid-D1E44199-7EB7-4A49-B104-6D6A9355838C" isImmediate="true" name="" sourceRef="StartAnalysis" targetRef="sid-CDB70F30-11B7-4936-917A-60C48CBB17D7"/>
        <sequenceFlow id="sid-0D2E4763-AFE9-46E2-BB78-9CEBB9914F7E" isImmediate="true" name="No" sourceRef="IsInstrumentInError" targetRef="UpdateAnalysisStateToScheduled">
            <conditionExpression id="sid-0dca0b5d-2c34-4199-93ed-da4ccb4c2ef2" xsi:type="tFormalExpression"> ${IsInstrumentInError==false}</conditionExpression>
        </sequenceFlow>
        <sequenceFlow id="sid-9A40CAAD-EA28-43D3-B0B6-89129321B64B" isImmediate="true" name="" sourceRef="sid-CDB70F30-11B7-4936-917A-60C48CBB17D7" targetRef="UpdateAnalysisStateToInProgress"/>
        <sequenceFlow id="sid-615FBB43-F773-4701-9C35-5860E7AE10B2" isImmediate="true" name="No" sourceRef="DoesUserContinue" targetRef="UpdateAnalysisStateToError">
            <conditionExpression id="sid-cb9cfe8e-f4b5-4a51-bc3e-015a064413e0" xsi:type="tFormalExpression"> ${empty VialNumber}</conditionExpression>
        </sequenceFlow>
        <sequenceFlow id="sid-43298455-F11D-464C-A804-9999D7A63A52" isImmediate="true" name="" sourceRef="StartEvent" targetRef="ValidAnalysis"/>
        <sequenceFlow id="sid-41894BD6-0CAB-47DB-992F-1882A517AB9F" isImmediate="true" name="" sourceRef="UpdateAnalysisStateToError" targetRef="EndEventError"/>
        <sequenceFlow id="sid-C917E421-F0E4-4F6D-A644-1A750404D45E" isImmediate="true" name="Yes" sourceRef="IsInstrumentIdlePriorityOrder1" targetRef="StartAnalysisInEZChrom">
            <conditionExpression id="sid-cd925f7c-e81d-42be-983d-040a029e8dad" xsi:type="tFormalExpression"> ${IsInstrumentIdle==true}</conditionExpression>
        </sequenceFlow>
        <sequenceFlow id="sid-408E46D7-84BE-4D3E-A767-68F89091C695" isImmediate="true" name="No" sourceRef="IsInstrumentIdlePriorityOrder1" targetRef="IsInstrumentInError">
            <conditionExpression id="sid-f287908b-bf26-4b03-a876-f91bd4134013" xsi:type="tFormalExpression"> ${IsInstrumentIdle==false}</conditionExpression>
        </sequenceFlow>
        <sequenceFlow id="sid-37FCF0E5-45E5-468B-A37F-9B9379C41B58" isImmediate="true" name="" sourceRef="sid-6C7071D6-CE99-46D9-9D15-9D59E8C47118" targetRef="UpdateIntrumentStatusToError"/>
        <sequenceFlow id="sid-E405AE84-E015-4AB8-BFEB-502A804D39C9" isImmediate="true" name="" sourceRef="UpdateAnalysisStateToScheduled" targetRef="MonitoringInstrumentStatusChange"/>
        <sequenceFlow id="sid-CF3B924A-46FC-40E6-BC4A-285AE0CC9C4C" isImmediate="true" name="" sourceRef="UserConfirmVial" targetRef="DoesUserContinue"/>
        <sequenceFlow id="sid-06C49699-C486-4287-8753-6D4631760D1E" isImmediate="true" name="" sourceRef="AutomaticInstrumentSelection" targetRef="UserConfirmVial"/>
        <sequenceFlow id="sid-BAF33379-610C-4603-8BE9-F61BDBDB3D49" isImmediate="true" name="" sourceRef="MonitoringInstrumentStatusChange" targetRef="InstrumentsCheckup">
            <extensionElements>
                <activiti:executionListener class="com.persistent.greenlab.workflow.scheduler.MonitorInstrumentFinishedExecutionListener"/>
            </extensionElements>
        </sequenceFlow>
        <sequenceFlow id="sid-16330616-A681-4C50-A56E-0D7824FF9C55" isImmediate="true" name="" sourceRef="ValidAnalysis" targetRef="IsValidCommand"/>
        <sequenceFlow id="sid-E5F8C44A-9D50-4054-A75A-03675C2A77BB" isImmediate="true" name="" sourceRef="InstrumentsCheckup" targetRef="IsInstrumentIdlePriorityOrder1"/>
        <sequenceFlow id="sid-442912D1-02D2-42A2-BDB4-D5ECBC843FFD" isImmediate="true" name="Yes" sourceRef="IsValidCommand" targetRef="InstrumentsCheckup">
            <conditionExpression id="sid-d02274f0-894a-41c1-88dc-39f9082a76b7" xsi:type="tFormalExpression"> ${IsValidCommand==true}</conditionExpression>
        </sequenceFlow>
        <sequenceFlow id="sid-55B0D7CE-0A83-4D9C-94C0-6EADBC5F311A" isImmediate="true" name="" sourceRef="sid-2A87A051-E234-42DC-B153-6FFE5739D8AE" targetRef="IsThereAtLeastOneInstrumentOK"/>
        <sequenceFlow id="sid-7AF88DEA-00C9-40F8-9725-5DB1925388A1" isImmediate="true" name="Yes" sourceRef="IsInstrumentInError" targetRef="sid-6C7071D6-CE99-46D9-9D15-9D59E8C47118">
            <conditionExpression id="sid-ac14e665-709d-45cf-bc31-0dc7078dc50b" xsi:type="tFormalExpression"> ${IsInstrumentInError==true}</conditionExpression>
        </sequenceFlow>
        <sequenceFlow id="sid-521E196C-F674-443B-8439-A6A4F873507C" isImmediate="true" name="" sourceRef="sid-CDB70F30-11B7-4936-917A-60C48CBB17D7" targetRef="UpdateInstrumentStatusIdlToRunning"/>
        <sequenceFlow id="sid-DFFBD589-C235-4A9E-AEFD-FEECEDB28D75" isImmediate="true" name="" sourceRef="sid-54E7C57C-4100-4318-9359-C398FC3FCDBD" targetRef="UpdateInstrumentRunningToIdle"/>
        <sequenceFlow id="sid-73440689-B306-4AAA-8B5C-E865886AAAC5" isImmediate="true" name="" sourceRef="UpdateInstrumentRunningToIdle" targetRef="sid-270AAB82-043E-4B33-96F3-E8B09651C221"/>
        <sequenceFlow id="sid-3DA1F847-D44C-4972-93B8-2E76F2D0E4F8" isImmediate="true" name="Yes" sourceRef="IsThereAtLeastOneInstrumentOK" targetRef="AutomaticInstrumentSelection">
            <conditionExpression id="sid-8fdb2d9e-9161-4dae-9dd4-333b24a527b3" xsi:type="tFormalExpression"> ${IsThereAtLeastOneInstrumentOK==true}</conditionExpression>
        </sequenceFlow>
        <sequenceFlow id="sid-826DEFCA-04C2-4781-A783-3FE4CC0BF8A5" isImmediate="true" name="" sourceRef="sid-6C7071D6-CE99-46D9-9D15-9D59E8C47118" targetRef="sid-67D25F92-398D-4020-A0CD-BA527395F9B5"/>
        <sequenceFlow id="sid-EA0D402C-EB86-481B-BD52-FF8D201E9F37" isImmediate="true" name="" sourceRef="sid-54E7C57C-4100-4318-9359-C398FC3FCDBD" targetRef="UpdateAnalysisStateInProgressToEnded"/>
        <sequenceFlow id="sid-1A88D597-C65D-493F-BDE4-35B36CA3BB34" isImmediate="true" name="No" sourceRef="IsValidCommand" targetRef="EndEventInvalidCommand">
            <conditionExpression id="sid-6941bb0b-3c3c-4675-acb6-e7d230e40ea9" xsi:type="tFormalExpression"> ${IsValidCommand==false}</conditionExpression>
        </sequenceFlow>
        <sequenceFlow id="sid-BD22C095-E7E8-48B3-A8B8-77D671C40354" isImmediate="true" name="" sourceRef="UpdateIntrumentStatusToError" targetRef="sid-2A87A051-E234-42DC-B153-6FFE5739D8AE"/>
        <sequenceFlow id="sid-FA00DF1B-6B7E-42F1-8439-AA2E62EAE606" isImmediate="true" name="Yes" sourceRef="DoesUserContinue" targetRef="UpdateXMLPartOtherInstrument">
            <conditionExpression id="sid-7416ab38-9047-4306-85ef-97e64c8b0c40" xsi:type="tFormalExpression"> ${!empty VialNumber}</conditionExpression>
        </sequenceFlow>
        <sequenceFlow id="sid-6E601F06-BBF8-4708-8EF0-4FD1D95C8A03" isImmediate="true" name="No" sourceRef="IsThereAtLeastOneInstrumentOK" targetRef="UpdateAnalysisStateToError">
            <conditionExpression id="sid-c8545b25-dcc0-4aa8-bec0-7894c4906f6f" xsi:type="tFormalExpression"> ${IsThereAtLeastOneInstrumentOK==false}</conditionExpression>
        </sequenceFlow>
        <sequenceFlow id="sid-FF527D19-F32D-4D49-87C3-F638838885C2" isImmediate="true" name="" sourceRef="UpdateXMLPartOtherInstrument" targetRef="InstrumentsCheckup"/>
        <sequenceFlow id="sid-BA416BE3-A5CD-4DA2-8006-90A43264F265" isImmediate="true" name="" sourceRef="UpdateInstrumentStatusIdlToRunning" targetRef="sid-3B14D52E-5449-44B9-B344-68EB68793C39"/>
        <sequenceFlow id="sid-F79DE1A4-EFD9-44EF-87CE-8C662658DCA1" isImmediate="true" name="" sourceRef="sid-3B14D52E-5449-44B9-B344-68EB68793C39" targetRef="MonitoringAnalysis"/>
        <sequenceFlow id="sid-25CA92FA-094F-4789-8932-887E6B7EF165" isImmediate="true" name="" sourceRef="UpdateAnalysisStateToInProgress" targetRef="sid-3B14D52E-5449-44B9-B344-68EB68793C39"/>
        <sequenceFlow id="sid-E54E2C94-5D7C-485A-96C6-7D9E4228A7CB" name="" sourceRef="MonitoringAnalysis" targetRef="GateWayRunFinished"/>           
        <sequenceFlow id="sid-A63C7EFD-8B52-45D8-A74C-074528E3CF24" name="Yes" sourceRef="GateWayRunFinished" targetRef="sid-54E7C57C-4100-4318-9359-C398FC3FCDBD">
  <conditionExpression id="RunIsFinished" xsi:type="tFormalExpression"> ${RunIsFinished==true}</conditionExpression>
        </sequenceFlow>
        <sequenceFlow id="sid-C4543058-915D-45C9-A15C-5F27B4AD16E1" name="" sourceRef="TimerWaitingEndOfRun" targetRef="MonitoringAnalysis"/>
        <sequenceFlow id="sid-A4EB997B-29B6-4590-B229-6EB28D010183" name="No" sourceRef="GateWayRunFinished" targetRef="TimerWaitingEndOfRun">
            <conditionExpression id="RunIsNotFinished" xsi:type="tFormalExpression"> ${RunIsFinished==false}</conditionExpression>
        </sequenceFlow> 
    </process>

jbarrez
Star Contributor
Star Contributor
JavaDelegate is an interface, so how could you write something like:

public class MySecondServiceTaskDelegate extends JavaDelegate

Did you mean implements there?

Secondly, when both service tasks run in the same jvm, the static value shouldn't be null …

sor1
Champ in-the-making
Champ in-the-making
Sorry, yes, I mean implements.

I do not know if both service tasks run in the same jvm:
My process is executed by an external jar that is reponsible to start the process. The 2 delegate are defined in a same jar file.
The first task is synchrone, and the second task is asynchrone. If the second task is asynchrone, does that mean it is done in another jvm?

My tests seems to show that the same JVM is running for all the process: in the process list of the windows task manager, I can see one single java.exe corresponding to the jar responsible of starting the processes.
I can see that my problem (static variable set to null) happens after going throw an intermediateCatchEvent (timer), maybe this can help to understand the problem.

frederikherema1
Star Contributor
Star Contributor
How does your singleton-code look?

sor1
Champ in-the-making
Champ in-the-making
Thanks for spending time on this problem.
See at the beginning of this topic, this is explained: this is very simple (static class and static member). I cannot use the singleton pattern (with a getInstance() method that would re-create my object if it is null) because I really need to re-use my object (created in the first service task) in the second service task.

jbarrez
Star Contributor
Star Contributor
Then I got no clue what goes wrong … could you create a simple unit test demonstrating the problem, with a minimal bpmn 2.0 xml?

sor1
Champ in-the-making
Champ in-the-making
OK, I have to send a simple prototype. I am starting immediatly but it will take sometimes. Thanks.

sor1
Champ in-the-making
Champ in-the-making
To reproduce the problem:
1)Have a simple process with a timer set to PT30S between the 2 service tasks: Start–>FirstTask–>Timer–>SecondTask–> End.
2)And the static member manipulation explained above.
3)Have a jar file responsible of starting the process: so it does this kind of code: activitiRuntimeService.startProcessInstanceByKey("MySimpleProcess");
4)Activiti Explorer is deployed on tomcat and the tomcat service is started.

Result:
In the second task, you have a java.lang.NullPointerException because the static object is null.
If now I stop the tomcat server, I do not have the exception and the process ends successfully.

My interpretation is that Activiti Explorer takes the responsibility to continue the process after the timer (according to the Activiti database content). So in its JVM, of course the static member was not initialized.
If an expert could confirm this interpretation I would appreciate.

Thanks.