Skip to content
This repository
Browse code

Refreshing the store list for the read only store management servlet.

  • Loading branch information...
commit 06579fa08deea6c4d86a2b6337a9ec3c4d854ab4 1 parent 2b0bee6
Chris Riccomini authored afeinberg committed
14 src/java/voldemort/server/http/gui/ReadOnlyStoreManagementServlet.java
@@ -61,7 +61,7 @@
61 61 private static final long serialVersionUID = 1;
62 62 private static final Logger logger = Logger.getLogger(ReadOnlyStoreManagementServlet.class);
63 63
64   - private List<ReadOnlyStorageEngine> stores;
  64 + private volatile List<ReadOnlyStorageEngine> stores;
65 65 private VelocityEngine velocityEngine;
66 66 private FileFetcher fileFetcher;
67 67
@@ -78,9 +78,17 @@ public void init() throws ServletException {
78 78 super.init();
79 79 VoldemortServer server = (VoldemortServer) getServletContext().getAttribute(VoldemortServletContextListener.SERVER_KEY);
80 80
  81 + initStores(server);
  82 + initVelocity();
  83 + setFetcherClass(server);
  84 + }
  85 +
  86 + public void initStores(VoldemortServer server) {
81 87 this.stores = getReadOnlyStores(server);
  88 + }
  89 +
  90 + public void initVelocity() {
82 91 this.velocityEngine = (VelocityEngine) Utils.notNull(getServletContext().getAttribute(VoldemortServletContextListener.VELOCITY_ENGINE_KEY));
83   - setFetcherClass(server);
84 92 }
85 93
86 94 private void setFetcherClass(VoldemortServer server) {
@@ -117,6 +125,7 @@ private void setFetcherClass(VoldemortServer server) {
117 125 @Override
118 126 public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
119 127 IOException {
  128 + initStores((VoldemortServer) getServletContext().getAttribute(VoldemortServletContextListener.SERVER_KEY));
120 129 Map<String, Object> params = Maps.newHashMap();
121 130 params.put("stores", stores);
122 131 velocityEngine.render("read-only-mgmt.vm", params, resp.getOutputStream());
@@ -200,6 +209,7 @@ private String getRequired(HttpServletRequest req, String name) throws ServletEx
200 209 }
201 210
202 211 private ReadOnlyStorageEngine getStore(String storeName) throws ServletException {
  212 + initStores((VoldemortServer) getServletContext().getAttribute(VoldemortServletContextListener.SERVER_KEY));
203 213 for(ReadOnlyStorageEngine store: this.stores)
204 214 if(store.getName().equals(storeName))
205 215 return store;

0 comments on commit 06579fa

Please sign in to comment.
Something went wrong with that request. Please try again.