lockDoc.put(LockDef.LOCK_ATTEMPT_COUNT.field, 0);
lockDoc.put(LockDef.INACTIVE_LOCK_TIMEOUT.field, pLockOptions.getInactiveLockTimeout());
// Insert, if successful then get out of here.
final WriteResult result = getDbCollection(pMongo, pSvcOptions).insert(lockDoc, WriteConcern.NORMAL);
final CommandResult cmdResult = result.getLastError();
if (cmdResult.getErrorMessage() != null) return null;
if (pSvcOptions.getEnableHistory())
{ LockHistoryDao.insert( pMongo, pLockName, pSvcOptions, pLockOptions, serverTime, LockState.LOCKED, lockId, false); }
return lockId;