如果要设计实现从多个服务器同时删除同一个文件名的文件,那么流程应该怎么样呢?
见我几个月前的邮件:
Let MultipleWebServerAgent as the first-class controller and it will control all the WebServerAgent ,each WebServerAgent maintains a connection/access to a specified web server.
Normal Process :When do multiple delete , it do as follows:
a. Traverse all the WebServerAgents (W1,W2…Wn)
b. Create a local folder using the W(i)’s machine name as the folder name ,and emote download the folder from W(i) to local inside the folder that just created.
c. Remote delete the folder from W(i)
d. If c is a success operation(without any exception ) ,then add the WebserverAgent of W(i) just operated into the successWebAgent list.
e. If (a) loop is finished ,which means the whole multiple delete operation is down ,then do local cleanup work.
f. Local clean up work is very easy ,just delete all the local folders created in step (b)
Exception Process: Exception occurs will lead to rollback ,the action is as follows:
a. Traverse all the WebServerAgents (W1,W2…Wn)
b. Create a local folder using the W(i)’s machine name as the folder name ,and emote download the folder from W(i) to local inside the folder that just created.
c. Remote delete the folder from W(i)
d. If c is a fail operation(throws exception ) ,then mark the WebserverAgent of W(i) just operated as failed WebServerAgent, break the (a) loop
e. Rollback operation: traverse all the successWebAgentlist of Normal Process step (d), and for each WebAgent ,do the folder upload work which can upload the folder from local back to WebServer
f. Local clean up. delete all the local folders created in step (b)