[WIP][SPARK-1477]: Add the lifecycle interface 

The reason for this is java code inherited this interface easier.