TEPHRA-271 Wait for the refresh thread to stop during shutdown to prevent race conditions

Signed-off-by: poorna <poorna@apache.org>
diff --git a/tephra-core/src/main/java/org/apache/tephra/coprocessor/TransactionStateCache.java b/tephra-core/src/main/java/org/apache/tephra/coprocessor/TransactionStateCache.java
index a80ce61..ac329f9 100644
--- a/tephra-core/src/main/java/org/apache/tephra/coprocessor/TransactionStateCache.java
+++ b/tephra-core/src/main/java/org/apache/tephra/coprocessor/TransactionStateCache.java
@@ -78,6 +78,7 @@
   protected void shutDown() throws Exception {
     if (refreshService != null) {
       refreshService.interrupt();
+      refreshService.join(1000);
     }
 
     if (storage != null) {