Moved java func init outside map.
same change to reducer