Add Java part of polling and timing functions