When setting layout outputs on a node also set a flag indicating if the layout changed. Read this flag before transferring outputs to java. JNI calls are very expensive so the less of them we need to do the better. Possibly re-use the hasNewLayout flag.