jPOS
jPOS copied to clipboard
SimpleKeyFile.getKeys() seems to load the key file for every key.
Doesn’t this load the file for every key?
https://github.com/jpos/jPOS/blob/c837c2f135c0ea4866148ab4a880565dda412c63/jpos/src/main/java/org/jpos/security/SimpleKeyFile.java#L213
Perhaps we could call load() at the beginning of the getKeys() method, and add an overload of getkey() that receives a boolean telling if it has to perform the load(), then in getKey(String) call it with true, and in getKeys() call it with false.
Other possible enhancements could be to add configuration properties for:
- loading only if the file timestamp changed.
- setting load frequency, i.e., don't check if elapsed time is less than some given period, in this case we would have two options for
setKey(): - Add a
readonlyproperty, and throw an exception if called. - When calling load, pass a parameter to force the file loading.
I'm willing to implement decided options in a PR.