I have a system which services a large amount of transactions. 
The timeout strategy applies for only a part of a transaction.

A complete transaction here consists of some execution workflow, pre-processing, a remote call, post-processing etc..

For example,

> 
> // some code
> 
> 
> // START TIMER
> 
> 
> try
>  {
> 
> 
> 
> > 
> > CallInput remoteInput = fInputProcessor.transform(callContext);
> > 
> > 
> > CallOutput remoteOutput = fRemoteInvoker.invoke(remoteInput);
> > 
> > 
> > TransactionOutput output = fOutputProcessor.transform(remoteOutput);
> > 
> > 
> > 
> 
> 
> }
> 
> 
> catch(TimeoutException ex)
>  {
> 
> 
> }
> 
> 
> // some code
> 
> 
> 

Say the timeout is for 500ms. It may occur during the Input processing, the remote call or the output processing. 

Can you list some possible ways of generating the Timeout after 500ms? Assume I cannot split the 3 blocks into a new thread.