Hi,
Thank you for your response. I tried a a random generating sensor and it works perfectly as the example. So it is best to say that the problem comes from my implementation of the sensor. Let me explain a bit further about my scenario. I use an ultrasonic sensor to collect the distance value through the GPIO pin of the raspberry Pi. To access those GPIO of the raspi, I have to use the library pi4j, so all those gpio stuff comes from that library. The thread.sleep in adjustDistance is to create the "rest time" between the high pulse and the low pulse of the ultrasonic, so the distance value can be calculated based on those pulses. As I mentioned, the leshan server can read the value from the ultrasonic, but only once because the adjustDistance method seems not to loop inside the runable() of the main method DistanceSensor. My best bet is that the runable() try to initiate the new run when the adjustDistance() hasn't finished yet, so I tried to increase the period time in scheduler.scheduleAtFixedRate but it doesn't work either.