Friday, September 26, 2008

Run Class Method Pattern

just to keep in mind a pattern for Run method recommended by Best Practices for classes


public void run()
{
#OCCRetryCount
;
try
{
ttsbegin;

this.adjustSetupTime();

ttscommit;

this.prodCostEstimation();
}
catch (Exception::Deadlock)
{
retry;
}
catch (Exception::UpdateConflict)
{
if (appl.ttsLevel() == 0)
{
if (xSession::currentRetryCount() >= #RetryNum)
{
throw Exception::UpdateConflictNotRecovered;
}
else
{
retry;
}
}
else
{
throw Exception::UpdateConflict;
}
}
}