Java api and usage in java cluster sample, see #2895