adding synchronized to monitor to call it by dif threads