Display JVM heap details using rJava and R
June 24, 2014 Leave a comment
I finished the first full flow that pulls data from the JVM using JMX and dynamically updates a graph in a browser. I use rJava as the layer between R and Java. I code many lines of java, of course, using jdk 8.
realtimeyoungdata <- function(){
realtimeyoungdataobserver <- .jnew("com/rxjava/jmx/YoungGenPeriodicObserver")
.jcall(realtimeyoungdataobserver,"V","consume")
occupancy <- .jcall(realtimeyoungdataobserver ,"Lcom/rxjava/jmx/YoungGenOccupancy;","getOccupancy")
used <- occupancy$getUsed()
max <- occupancy$getMax()
print(paste("User[", used,"] Max [", max,"]"))
result <- c(used, max)
return(result)
}