1.

How To Limit A Flow Service Executed Only By One Thread At A Time?

Answer»

•Create a JAVA service
•Create a private static object on the shared source (private static Object LOCK_OBJ = new Object(); )
•Have the code below on the java service source:
IDataCursor IDC = pipeline.getCursor();
IDataCursor idcResult = null;
try {
// put this section into a critical section to ENSURE single-threaded execution
synchronized(LOCK_OBJ)
{
Execute a flow service using Service.doInvoke
}
idc.destroy();
idcResult.destroy();
} catch (Exception EXC){ 
ServerAPI.logError(exc); 
idc.destroy();
throw new ServiceException(exc.toString()); }\

•Create a java service
•Create a private static object on the shared source (private static Object LOCK_OBJ = new Object(); )
•Have the code below on the java service source:
IDataCursor idc = pipeline.getCursor();
IDataCursor idcResult = null;
try {
// put this section into a critical section to ensure single-threaded execution
synchronized(LOCK_OBJ)
{
Execute a flow service using Service.doInvoke
}
idc.destroy();
idcResult.destroy();
} catch (Exception exc){ 
ServerAPI.logError(exc); 
idc.destroy();
throw new ServiceException(exc.toString()); }\



Discussion

No Comment Found