I would like to refresh state in a cache in Storm spout. I am able this successfully in the bolt with Tick tuple. It would be great to know if there is a similar pattern to use or some other way to periodically wake up and do something. I could potentially have a timer to do this. Would that lead to any concurrency issues with the Storm framework?
I don't believe there's anything built in, but take a look at how we do commits in the Kafka spout https://github.com/apache/storm/blob/fbeafdcbb1e4be1263b91be7ba75a15aa6e885a8/external/storm-kafka-client/src/main/java/org/apache/storm/kafka/spout/KafkaSpout.java#L278.
Basically we set a timestamp when we commit, and check the timestamp when nextTuple is called. If the timestamp is sufficiently far in the past, we commit and reset the timestamp.
Doing it this way means you don't have to worry about concurrency. Storm will call all methods on the spout from the same thread.
If you decide to use a Timer or similar, you will need to make sure your cache is synchronized between the Timer thread and the regular Storm executor thread.