I was wondering what the implications are for using static methods in a Java EE application.
For example: There is a class that handles converting of dates, reordering of strings etc.
All methods in this class are static.
These methods are used by Servlets.
Does this mean that the static methods need to be thread safe (in that if many users are using the application at the same time and are accessing the static method at the same time that there could be some issues)?
Edit I would like to know about this in the context of a web application – are two users going to hit the static methods at the same time and mess with each others result (of the static method)?
accessing the methods in parallel is fine, as long as there are not shared class variables; e.g. if the method declares its own stuff, you’re good:
The above is fine.
This one isn’t.