@Path("/execute/{ObjID}/{ObjInsId}/{resourceId}") @POST @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.TEXT_PLAIN) public Response sendExecute( @PathParam("ObjID") String objectId, @PathParam("ObjInsId") String objectInstanceId, @PathParam("resourceId") String resourceID, @QueryParam("ep") String endPoint, String value) throws InterruptedException { String string = objectId + "/" + objectInstanceId + "/" + resourceID; JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("operation", "execute"); jsonObject.addProperty("directory", string); jsonObject.addProperty("value", value); Info.setInfo(endPoint, jsonObject.toString()); CountDownLatch signal = Info.getCountDown(endPoint); if (signal == null) { return Response.status(200).entity("Devices not registered yet").build(); } signal.countDown(); CountDownLatch signalRead = new CountDownLatch(1); Info.setCountDownLatchMessageMap(endPoint, signalRead); signalRead.await(); String temp = Info.getClientSendToServerInfoMap(endPoint); Double result = Double.valueOf(temp); Double result1 = Double.valueOf(String.format("%.2f", result)); String temp1 = String.valueOf(result1); return Response.status(200).entity("execution success!The temperature is " + temp1).build(); }