Hi, IMHO thats not to bad as it looks
You could try also something similiar:
Code:
while(true)
  try{
     handle.execute("INSERT.....");
     break;
  }
  catch( DB_Exc& e )
  {
    <pseudo_code>
    StartAnotherThread
    SynchronizeThreads
    DiagnoseTheProblem
    IfYouCanTryAgain()
        OK_LetsTryAgain
    else
        NO_NotifyUser
        Break
    </pseudo>     
  }
}