Have method A keep track of how long it can execute and when the time is up, method A should exit so that method B can execute.