I was trying to invoke a service, and wanted to set a timeout for the same. I found two ways by which I can do so.