Hello Team,
I am trying to invoke two flow services parallelly using java ExecutorService But it is not happening.
Would you please let me know here I am going wrong.
// pipeline
IDataCursor pipelineCursor = pipeline.getCursor();
String message1 = IDataUtil.getString( pipelineCursor, “message1” );
String message2 = IDataUtil.getString( pipelineCursor, “message2” );
pipelineCursor.destroy();
//Input 1
IData input = IDataFactory.create();
IDataCursor inputCursor = input.getCursor();
IDataUtil.put( inputCursor, "message",message1 );
inputCursor.destroy();
//Input2
IData input1 = IDataFactory.create();
IDataCursor inputCursor1 = input1.getCursor();
IDataUtil.put( inputCursor1, "message2", message2 );
inputCursor1.destroy();
Callable callable1=new Callable(){
@Override
public Void call() throws Exception{
try{
Service.doInvoke( "javaServicePoc.services.SyncCall", "publisher1", input );
}catch( Exception e){
throw new ServiceException(e);
}
return null;
}
};
Callable callable2=new Callable(){
@Override
public Void call() throws Exception{
try{
Service.doInvoke( "javaServicePoc.services.SyncCall", "publisher2", input1 );
}catch( Exception e){
throw new ServiceException(e);
}
return null;
}
};
List<Callable<Void>> taskList=new ArrayList<Callable<Void>>();
taskList.add(callable1);
taskList.add(callable2);
ExecutorService executor=Executors.newFixedThreadPool(2);
try
{
executor.invokeAll(taskList);
executor.shutdown();
}
catch(InterruptedException ie){
throw new ServiceException(ie); // getting error here
}
}
Thanks in Advance