Optimal stopping time problem in a general framework