- statRetrievalTime = null;
-
- if (shard != null) {
- Timeout timeout = new Timeout(10, TimeUnit.SECONDS);
- try {
- Stopwatch timer = Stopwatch.createStarted();
-
- state = (OnDemandRaftState) Await.result(Patterns.ask(shard.getSelf(),
- GetOnDemandRaftState.INSTANCE, timeout), timeout.duration());
-
- statRetrievalTime = timer.stop().toString();
- ONDEMAND_RAFT_STATE_CACHE.put(name, state);
- } catch (Exception e) {
- statRetrievalError = e.toString();
- }
- }
-
- state = state != null ? state : OnDemandRaftState.builder().build();
+ return state;
+ } catch (Exception e) {
+ statRetrievalError = e.getCause().toString();
+ return OnDemandRaftState.builder().build();