i have a method that do some api calling to save an image on filenet repository and after that it do some logging on two database tables, and the whole method takes lots of time to execute, so i thought of separating the logging into a separate thread as follows:
public void createNewDocument(){
doSaveImage();
new Thread()
{
@Override
public void run()
{
try{
new LogDAO().addLog(log);
new ReportsDAO().addCreatedDocumentLog(productivityReport);
}catch(Exception e){
e.printStackTrace();
}
}
}.start();
}
and it works fine with no issues for single user, so my question is that considerd a bad design and can it cause issues when multiple users are calling this method concurrently (memory issue ?) or safety issue ?