JCAPSMentor - Java CAPS Unleashed - Basic to Expert Discussions

JCAPSMentor - Basic to Expert Discussions Jcaps, SOA, SUN, Netbeans, Enterprise, Sun System Application Server, Java, J2EE, EAI, JBI, Composite Application Platform Suite, EDI, SeeBeyond, HL7, Singapore

 
  FOLLOW US!
  JCAPSMentor

Visit us at Facebook



 

  Visitors LIVE! Stats
 
  Covering the World!
 
Asynchronous call in JCAPS BPEL (JCD)
The java.util.concurrent.ExecutorService interface represents an asynchronous execution mechanism which is capable of executing tasks in the background of a BPEL transaction. 

An ExecutorService is thus very similar to a thread pool. In fact, the implementation of ExecutorService present in the java.util.concurrentpackage is a thread pool implementation.

The below code could be incorporated into JCD (Java Collaboration Definition) to achieve concurrency in JCAPS - BPEL:

 /**
     * JCD Code: Asynchronous call to invoke any method
     * * *
     * @author Manesh Abhimanyu
     * @param String Input 1
     * @param String Input 2
     */
    public void asyncServiceMethod( final String input1, final String input2)
    {
        ExecutorService executor = Executors.newSingleThreadExecutor();
        try {
            Runnable task = new Runnable(){
                public void run()
                {
                    try {
                        invokeJCAPSMentor( input1, input2 );
                    } catch ( Exception ex ) {
                          // handle error which cannot be thrown back
                    }
                }
            };
            executor.execute( task );
        } catch ( Exception e ) {
            // handle error which cannot be thrown back
        }  finally {
            // gargabe collect
            executor.shutdown();
        }
    }






More reading:
Service Execute API


Author: Manesh Abhimanyu.

Labels: , , , , , , ,

 
Manesh Abhimanyu
Manesh is a Sr. EAI Consultant, at present working in Singapore (Little Red Dot).

His focus is in the areas of SOA, ESB and Enterprise Architecture Management.

Contact him via email (mak2powerATyahoo.co.in)

Menu
Archives
Links
Website developed & maintained by

Manesh Abhimanyu K. (Mak)

Click here to contact Manesh









Free Domain CO.NR