Unique per Java Action temp folder name

Hi I'm still learning this Java stuff and would like to know what is the correct way to create a unique folder in ${DEPLOYMENT}/data/tmp in such a way that when a Java action is called concurrently by multiple clients, that I don't end up with the concurrent calls trampling each other in terms of file reads and writes. Thankyou very much
2 answers


If you need separate directories then make sure the names are unique, if separate files is sufficiƫnt then use unique file names. I usaully take eithe the name of the fileand append the datetime up to milliseconds for the file names or use a java UUID for the names of the files. The same is true for the folders. See below for use of UUID:

import java.util.UUID;

UUID uniqueID= UUID.randomUUID();
String randomUUIDString = uuid.toString();

File documents are stored and retrieved by the runtime. In the Mendix cloud, it is not allowed to write to the file system directly.

What do you want to achieve? It sounds like some kind of temporary storage.