Use new Listener approach in java examples