Thank you for the work to build this library. In trying to use it, I have come up against the following concern:
To me a useful caching system would do the following:
- The cache holds onto the last value for the expiration period
- When the value expires, keep returning the obsolete value temporarily and start a separate background thread to refresh it.
- When the thread completes, update the cached value.
So the clients can always call the caching method and they always get a quick response.
The ExpiringSNTPCache does not do this. It merely returns null when the value is expired.
So I tried to write my own SNTPCache subclass to do what I wanted. Then I tried to call SNTP.setCache() with my new instance.
Then I ran into IllegalStateException("client already set");
Looking at the SNTP.setCache method, you've made it public, but it can only be called once by your own SNTP.init() static method. So no one else can modify the system.
I'm going to solve these issues by making a new wrapper class to wrap the SNTP class. Very easy to do. However, I suggest your library could be improved by adding this functionality yourself.
Thank you for the work to build this library. In trying to use it, I have come up against the following concern:
To me a useful caching system would do the following:
So the clients can always call the caching method and they always get a quick response.
The ExpiringSNTPCache does not do this. It merely returns null when the value is expired.
So I tried to write my own SNTPCache subclass to do what I wanted. Then I tried to call SNTP.setCache() with my new instance.
Then I ran into IllegalStateException("client already set");
Looking at the SNTP.setCache method, you've made it public, but it can only be called once by your own SNTP.init() static method. So no one else can modify the system.
I'm going to solve these issues by making a new wrapper class to wrap the SNTP class. Very easy to do. However, I suggest your library could be improved by adding this functionality yourself.