Since I couldnt get my web service to really support multiple users, Ive thought of simply implementing a FIFO kinda of queue like this:
(The code is made up on the spot right now. Therefore, ; may be missing, some variable declared wrong, etc. Ignore that. Just concentrate on the logic)
Would this work when multiple users call the web services at the same time to make the queue?
Since I couldnt get my web service to really support multiple users,
A correctly designed web service should be able to support multiple users - what exactly was the design problem you could not overcome?
Your proposed code looks like you have an ordinary web application, not a SOAP or RESTful web service.
What are the clients for your service using to access it?
The client is a CMS: Magento. There is a program there and it basically sends me points of Xs and Ys and generates a certain program which is always named the same way (no date, id order, nothing and no, this cannot be changed under no way, shape or form) which is then moved to somewhere else (a file server to be exact)
The problem is that when 2 users call the web services at the same time, there is a point where both users "use" that file (creating it, deleting it, copying it, etc) that they get mixed up with each other and errors pop up.
William Brogden wrote:How much time does the create/copy/delete cycle take?
Could you not encapsulate all of the file operations in a single object and synchronize access to that object?
(My sympathy for having to deal with such a horrible design)
The time is (estimated) about 15-20 seconds; It does a FTP transfer as well so.....
Lets say for example the code is something such as (again ignore things like missing ";" or uncorrect functions):
How would I correctly do what you mentioned about "encapsulate all of the file operations in a single object and synchronize access to that object"? That is doable.