@Test public void testConfigValueSetVsThread() throws InterruptedException { int origValue = env.getHitsPerPage(); final int threadValue[] = new int[1]; final CountDownLatch startLatch = new CountDownLatch(1); final CountDownLatch endLatch = new CountDownLatch(1); Thread thread = new Thread(new Runnable() { @Override public void run() { HttpServletRequest req = new DummyHttpServletRequest(); PageConfig pageConfig = PageConfig.get(req); RuntimeEnvironment e = pageConfig.getEnv(); startLatch.countDown(); try { endLatch.await(); } catch (InterruptedException ex) { ex.printStackTrace(); } threadValue[0] = e.getHitsPerPage(); } }); thread.start(); startLatch.await(); int newValue = origValue + 42; Configuration config = new Configuration(); config.setHitsPerPage(newValue); String configStr = config.getXMLRepresentationAsString(); Response res = target("configuration") .request() .put(Entity.xml(configStr)); assertEquals(Response.Status.NO_CONTENT.getStatusCode(), res.getStatus()); endLatch.countDown(); thread.join(); assertEquals(newValue, threadValue[0]); env.setHitsPerPage(origValue); }
@GET @Produces(MediaType.APPLICATION_XML) public String get() { return env.getConfigurationXML(); }
ConfigurationController { @GET @Produces(MediaType.APPLICATION_XML) public String get() { return env.getConfigurationXML(); } }
ConfigurationController { @GET @Produces(MediaType.APPLICATION_XML) public String get() { return env.getConfigurationXML(); }  }
ConfigurationController { @GET @Produces(MediaType.APPLICATION_XML) public String get() { return env.getConfigurationXML(); }  @GET @Produces(MediaType.APPLICATION_XML) String get(); @PUT @Consumes(MediaType.APPLICATION_XML) void set(final String body, @QueryParam("reindex") final boolean reindex); @GET @Path("/{field}") @Produces(MediaType.APPLICATION_JSON) Object getField(@PathParam("field") final String field); @PUT @Path("/{field}") void setField(@PathParam("field") final String field, final String value); @POST @Path("/authorization/reload") void reloadAuthorization(); }
ConfigurationController { @GET @Produces(MediaType.APPLICATION_XML) public String get() { return env.getConfigurationXML(); }  @GET @Produces(MediaType.APPLICATION_XML) String get(); @PUT @Consumes(MediaType.APPLICATION_XML) void set(final String body, @QueryParam("reindex") final boolean reindex); @GET @Path("/{field}") @Produces(MediaType.APPLICATION_JSON) Object getField(@PathParam("field") final String field); @PUT @Path("/{field}") void setField(@PathParam("field") final String field, final String value); @POST @Path("/authorization/reload") void reloadAuthorization();  }