Need help in handling error when two processes tries to access same file

Hi ,

I need help in handling error scenarion mention below .
Integration:

  1. External partner ftp a file to /ns// location on RI sevrer.
  2. The service picks up the data and post on ext gateway port for invocation of tn receive service.
  3. The processing rule service converts file to required format and puts at target ftp location

In the error scenario , our client puts multiple files exatly at same time which cause error as below in processing rule service
“The process cannot access the file because it is being used by another process.”

We have wrote steps from ftp login to ftp put in repeate and each time we are recreating the file name . The file name has Date time stamp till milliseconds appended. But when abover error comes the process is not using the newly created name subsequent repeate cycles, even though it is created as shown in activity mesage below.
( I belive that is because ftp session logout not happening . With above run time error next branch on ftp return code is not getting executed , instead it goes to next repeate cycle directly. I tried using try catch to log off ftp session inside repeate but as main is exit on success repeate does not happen). Can you please help in how to handle this error , below Activity mesage may explain it in more details.

[TABLE=“class: cms_table_caf-table, width: 100%”]
[TR=“class: cms_table_portlet-section-body”]
[TD=“width: 220”]2012-10-31 14:57:01.162 CET[/TD]
[TD=“width: 15%”]Error[/TD]
[TD=“width: 30%”][/TD]
[TD]com.wm.util.BasisException: 550 abcDATA20121031145620708.edi: The process cannot access the file because it is being used by another process. at com.wm.util.BasisRuntimeException.(BasisRuntimeException.java:223) at com.wm.app.b2b.server.ISRuntimeException.(ISRuntimeException.java:275) at pub.flow.throwExceptionForRetry(flow.java:540) at sun.reflect.GeneratedMethodAccessor763.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.wm.app.b2b.server.JavaService.baseInvoke(JavaService.java:403) at com.wm.app.b2b.server.invoke.InvokeManager.process(InvokeManager.java:631) at com.wm.app.b2b.server.util.tspace.ReservationProcessor.process(ReservationProcessor.java:41) at com.wm.app.b2b.server.invoke.StatisticsProcessor.process(StatisticsProcessor.java:44) at com.wm.app.b2b.server.invoke.ServiceCompletionImpl.process(ServiceCompletionImpl.java:253) at com.wm.app.b2[/TD]
[/TR]
[TR=“class: cms_table_portlet-section-alternate”]
[TD=“width: 220”]2012-10-31 14:57:01.068 CET[/TD]
[TD=“width: 15%”]Message[/TD]
[TD=“width: 30%”][/TD]
[TD]New File Name abcDATA20121031145701068.edi[/TD]
[/TR]
[TR=“class: cms_table_portlet-section-body”]
[TD=“width: 220”]2012-10-31 14:56:41.036 CET[/TD]
[TD=“width: 15%”]Message[/TD]
[TD=“width: 30%”][/TD]
[TD]New File Name abcDATA20121031145641036.edi[/TD]
[/TR]
[TR=“class: cms_table_portlet-section-alternate”]
[TD=“width: 220”]2012-10-31 14:56:21.005 CET[/TD]
[TD=“width: 15%”]Message[/TD]
[TD=“width: 30%”][/TD]
[TD]Successfully changed the directory[/TD]
[/TR]
[TR=“class: cms_table_portlet-section-body”]
[TD=“width: 220”]2012-10-31 14:56:20.896 CET[/TD]
[TD=“width: 15%”]Message[/TD]
[TD=“width: 30%”][/TD]
[TD]Logged on to XYZ FTP server[/TD]
[/TR]
[TR=“class: cms_table_portlet-section-alternate”]
[TD=“width: 220”]2012-10-31 14:56:20.708 CET[/TD]
[TD=“width: 15%”]Message[/TD]
[TD=“width: 30%”][/TD]
[TD]New File Name abcDATA20121031145620708.edi[/TD]
[/TR]
[TR=“class: cms_table_portlet-section-body”]
[TD=“width: 220”]2012-10-31 14:56:19.771 CET[/TD]
[TD=“width: 15%”]Message[/TD]
[TD=“width: 30%”][/TD]
[TD]Child level attributes set. Internal id: 5b9g13007arhnff0000010vp[/TD]
[/TR]
[TR=“class: cms_table_portlet-section-alternate”]
[TD=“width: 220”]2012-10-31 14:56:19.724 CET[/TD]
[TD=“width: 15%”]Message[/TD]
[TD=“width: 30%”][/TD]
[TD]Processing initiated[/TD]
[/TR]
[/TABLE]

Hi,

This issue was resolved by setting up newSession parameter to true in login service.
And handling logg off in case of thread latch scenario.

Thanks to reamon for his quick help !!!

Yep that should does the trick:)…glad to hear problem resolved: