Optimize java source-based UDF invocation

Patch by Robert Stupp; reviewed by Benjamin Lerer for CASSANDRA-7924