[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [smila-dev] BPEL Workflow: How deserialize calls to workflows or fork two different sequence pipeline

Thank you very much Jürgen.

I have an over structure to manage Record. The base object is defined into the class pasted below
...
public abstract class AbstractRecordImpl implements RecordInterface{
    protected final Record record;

    public AbstractRecordImpl(Record r){
        record = r;
        record.getMetadata().put(RecordInterface.Field.source.name(), getSourceName());
    }
   
    /**
     * Put an entry in metadata member of {@link Record} object with {@link String} value into a synchronized section on given {@link Record} object
     * @param key the {@link IField} key
     * @param value The {@link String} value
     */
    public void put(IField key, String value){
            record.getMetadata().put(key.name(),value);   
    }
   
    /**
     * Put an entry in metadata member of {@link Record} object with {@link Boolean} value into a synchronized section on given {@link Record} object
     * @param key the {@link IField} key
     * @param value The {@link Boolean} value
     */
    public void put(IField key, Boolean value){
            record.getMetadata().put(key.name(),value);   
    }

    /**
     * Put an entry in metadata member of {@link Record} object with {@link Number} value into a synchronized section on given {@link Record} object
     * @param key the {@link IField} key
     * @param value The {@link Number} value
     */
    public void put(IField key, Number value){
            record.getMetadata().put(key.name(),value);   
    }
   
    /**
     * Put an entry in metadata member of {@link Record} object with {@link Any} value
     * @param key the {@link IField} key
     * @param value The {@link Any} value
     */
    public void put(IField key, Any value){
            record.getMetadata().put(key.name(),value);   
    }
...   
    /**
     * Put an attachment into {@link Record} object into a synchronized section on given {@link Record} object
     * @param key the {@link IAttachment} key
     * @param value The byte[] attachment value
     */
    public void put(IAttachment key, byte[] value){
            record.setAttachment(key.name(),value);
    }
 ...


I should change the putter methods like
...
    public void put(IField key, String value){
        synchronized (record) {
            record.getMetadata().put(key.name(),value);   
        }
    }
   
    public void put(IField key, Boolean value){
        synchronized (record) {
            record.getMetadata().put(key.name(),value);   
        }
    }

    public void put(IField key, Number value){
        synchronized (record) {
            record.getMetadata().put(key.name(),value);   
        }
    }

    public void put(IField key, Any value){
        synchronized (record) {
            record.getMetadata().put(key.name(),value);   
        }
    }
...   
    public void put(IAttachment key, byte[] value){
        synchronized (record) {
            record.setAttachment(key.name(),value);
        }
    }
...

This should made my deserialized sections thread safe working on the same record as you said, isn't it?

Then I should use in my BPEL file

<flow>

  <sequence>

     <invoke to call HTML processing workflow

  </sequence>

  <sequence>

    <invoke to call VIDEO processing workflow

  </sequence>

</flow>


That could work. Let me tell you what happens on next week.

Thank you very much.
Bye

Il 08/12/2011 15.59, Jürgen Schumacher ha scritto:

No, not this way.

If you process the same bulk in two separate actions of a asynchronous workflow you are working on two separate record instances, so everything should be fine.

The synchronization stuff is about writing to the same record in two pipelet invocations in the same BPEL workflow that are executed in parallel which could happen when using the BPEL <flow> activity. Then both pipelets would be working on the same record instance on the same blackboard. It could be necessary then to put write accesses to the records in your pipelet in a synchronized block, like

Record record = blackboard.getRecord(id);

synchronized (record) {

   record.getMetadata().put(attribute, value);

}

 

But as we never tried this before I’m not quite sure about this myself.

 

Cheers,

Jürgen.

 

From: smila-dev-bounces@xxxxxxxxxxx [mailto:smila-dev-bounces@xxxxxxxxxxx] On Behalf Of Lorenzo Eccher
Sent: Thursday, December 08, 2011 3:39 PM
To: smila-dev@xxxxxxxxxxx
Subject: Re: [smila-dev] BPEL Workflow: How deserialize calls to workflows or fork two different sequence pipeline

 

Grazie Jürgen.

You tell me that if I need to access to the same bulk in two sub-pipelines I need to create my own version of Record Implementation ad blackboard to introduce synchronization access to th record "attributes"?
Those objects in SMILA are not synchronized yet or that is what you want to do?

Thanks a lot, Lorenzo

Il 08/12/2011 8.50, Jürgen Schumacher ha scritto:

Buon giorno,


Yes, that should be possible using the BPEL <flow> activity, something like:

 

<flow>

  <sequence>

     … pipelets for HTML processing …

  </sequence>

  <sequence>

     … pipelets for video processing …

  </sequence>

</flow>

 

However, we did not yet try this out. But parallel processing in <forEach> activities works, so I assume that this should work, too.

Of course, you should not manipulate the same attributes in both sequences. It may even be necessary to do some synchronization of  record write accesses, as the AnyMap implementation is just based on simple unsynced HashMaps.

 

Regards,

Jürgen.




_______________________________________________
smila-dev mailing list
smila-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/smila-dev

 

--


Lorenzo Eccher
lorenzo.eccher@xxxxxx

Research & Development Laboratory

Engineering Ingegneria informatica s.p.a

EngiWeb Security srl
Via Solteri, 38 - 38100 Trento
Tel. +39-0461.1822110
Fax. +39-0461.1822199
www.eng.it

  Le informazioni trasmesse sono destinate esclusivamente alla persona o alla società in indirizzo e sono da intendersi confidenziali e riservate. Ogni trasmissione, inoltro, diffusione o altro uso di queste informazioni a persone o società differenti dal destinatario è proibita. Se ricevete questa comunicazione per errore, contattate il mittente e cancellate le informazioni da ogni computer.
  The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.



_______________________________________________
smila-dev mailing list
smila-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/smila-dev

--

Lorenzo Eccher
lorenzo.eccher@xxxxxx

Research & Development Laboratory

Engineering Ingegneria informatica s.p.a

EngiWeb Security srl
Via Solteri, 38 - 38100 Trento
Tel. +39-0461.1822110
Fax. +39-0461.1822199
www.eng.it

  Le informazioni trasmesse sono destinate esclusivamente alla persona o alla società in indirizzo e sono da intendersi confidenziali e riservate. Ogni trasmissione, inoltro, diffusione o altro uso di queste informazioni a persone o società differenti dal destinatario è proibita. Se ricevete questa comunicazione per errore, contattate il mittente e cancellate le informazioni da ogni computer.
  The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.