/** Close method to be used if the user defined function extends the RichFunction class */ public void close() { isRunning = false; collector.close(); try { FunctionUtils.closeFunction(userFunction); } catch (Exception e) { throw new RuntimeException("Error when closing the function: " + e.getMessage()); } }