Static Method to get Data from DB?
-
Hi, if i make a static method, that gets Data from my DB, will the method be threadsafe? I mean while one user requests some data and the method is running, can another user that wants to do the same, read/write the variables in this static method? I know it's a beginners question, i searched a lot but i didn't find an answer. Thanks for helping me in advance.
-
Hi, if i make a static method, that gets Data from my DB, will the method be threadsafe? I mean while one user requests some data and the method is running, can another user that wants to do the same, read/write the variables in this static method? I know it's a beginners question, i searched a lot but i didn't find an answer. Thanks for helping me in advance.
-
Variables declared locally in a static method are thread safe. Static variables declared in a class or structure are not thread safe.
--- single minded; short sighted; long gone;