You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@empire-db.apache.org by exxos <ha...@gmail.com> on 2010/08/27 18:45:06 UTC
Multi-threading and DBDatabase
Hello,
This question has already been initiated, but here, it is to talk about
another aspect.
http://mail-archives.apache.org/mod_mbox/incubator-empire-db-user/201005.mbox/ajax/%3CN1B-Y-aDviwXPs@Safe-mail.net%3E
A short reminder:
- Only one instance of DBDatabase is required for the whole application. It
can be save in a static variable, for example, at the start-up of the
application.
Now my question is:
In case of multi threading (sharing the same DBDatabse object between
thread), how can we trust that the return of getErrorMessage() will concern
the current execution?
Do we have to put in place a semaphore (a lock mechanism) on DBDatabase?
Regards,
exxos.
re: Multi-threading and DBDatabase
Posted by Rainer Döbele <do...@esteam.de>.
Hi exxos,
errors are kept on a per thread basis in a so called Thread-local storage (TLS), hence every thread has its own error status.
Regards
Rainer
from: exxos [mailto:hatufr@gmail.com]
to: empire-db-user@incubator.apache.org
re: Multi-threading and DBDatabase
Hello,
This question has already been initiated, but here, it is to talk about another aspect.
http://mail-archives.apache.org/mod_mbox/incubator-empire-db-user/201005.mbox/ajax/%3CN1B-Y-aDviwXPs@Safe-mail.net%3E
A short reminder:
- Only one instance of DBDatabase is required for the whole application. It can be save in a static variable, for example, at the start-up of the application.
Now my question is:
In case of multi threading (sharing the same DBDatabse object between thread), how can we trust that the return of getErrorMessage() will concern the current execution?
Do we have to put in place a semaphore (a lock mechanism) on DBDatabase?
Regards,
exxos.