modify node server thread and add shutdown method for node