I am currently working on a new project for university and was curious as to the best way to handle a class I've created to perform utility operations such as hashing passwords.
Should the utility class contain static methods so that I call them like
Utilities.hashPassword(password,salt);
Or should I create a new instance for each call
new Utilities().hashPassword(password, salt);
Right now I have a new instance for each call to a function inside that class, but im concerned about the performance implications of this and am wondering if its even nessecary to do.
My original reason for instantiating them was because I wasn't sure how thread-safety worked and was concerned that multiple users calling the same static function would cause problems. After reading some material on java concurrency I'm now pretty sure that even if the method is static it would be thread-safe.
Should I change them all to static methods? Would this improve performance? Right now my test server buckles under load.
Thanks