Add a function to be called during cleanup.
Add a function to be called during cleanup.
import org.apache.predictionio.workflow.CleanupFunctions
CleanupFunctions.add { MyStorageClass.close }
Call all cleanup functions in order added.
Call all cleanup functions in order added.
import org.apache.predictionio.workflow.CleanupFunctions try { // Much code that needs cleanup // whether successful or error thrown. } finally { CleanupFunctions.run() }
:: DeveloperApi :: Singleton object that collects anonymous functions to be executed to allow the process to end gracefully.
For example, the Elasticsearch REST storage client maintains an internal connection pool that must be closed to allow the process to exit.