[WIP] A new resource management for Flow

Change-Id: Ia2b47b4070a2dfabf4833bf1f0f3967ba3b032a7