// On all but every third invocation, throw a concurrency exception
// This is to test retries on the server-side
count++;
if( count % 3 != 0 )
{
module.currentUnitOfWork().addUnitOfWorkCallback( new UnitOfWorkCallback()
{
public void beforeCompletion()
throws UnitOfWorkCompletionException
{
throw new ConcurrentEntityModificationException( Collections.<EntityComposite>emptyList() );