当前位置: 首页>>代码示例>>Java>>正文


Java OConcurrentModificationException类代码示例

本文整理汇总了Java中com.orientechnologies.orient.core.exception.OConcurrentModificationException的典型用法代码示例。如果您正苦于以下问题:Java OConcurrentModificationException类的具体用法?Java OConcurrentModificationException怎么用?Java OConcurrentModificationException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OConcurrentModificationException类属于com.orientechnologies.orient.core.exception包,在下文中一共展示了OConcurrentModificationException类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: close

import com.orientechnologies.orient.core.exception.OConcurrentModificationException; //导入依赖的package包/类
@Override
public void close() {
	try {
		if (!isNested) {
			Tx.setActive(null);
		}
		if (isSuccess()) {
			commit();
		} else {
			rollback();
		}
		if (!isNested) {
			getDelegate().close();
		}
		OrientGraph graph = ((OrientGraph) getGraph().getBaseGraph());
		graph.commit();
		if (!isNested) {
			graph.close();
		}
	} catch (OConcurrentModificationException e) {
		throw e;
	}
}
 
开发者ID:Syncleus,项目名称:Ferma-OrientDB,代码行数:24,代码来源:OrientDBTx.java

示例2: testSessionManager

import com.orientechnologies.orient.core.exception.OConcurrentModificationException; //导入依赖的package包/类
public void testSessionManager() {
//        IObjectProxy iop;

        // correr test de store
//        this.store();
//          this.testStoreLink();
//        this.testUpdateLink();
//        this.testQuery();
//        testLoop();
//        this.lab();
        try {
            sm.commit();
        } catch (OConcurrentModificationException ccme) {

        } finally {
        }
    }
 
开发者ID:mdre,项目名称:odbogm,代码行数:18,代码来源:Test.java

示例3: removeUser

import com.orientechnologies.orient.core.exception.OConcurrentModificationException; //导入依赖的package包/类
@Override
public boolean removeUser(final String id) {
  checkNotNull(id);
  log.trace("Removing user: {}", id);

  try {
    return inTxRetry(databaseInstance).call(db -> {
      if (userEntityAdapter.delete(db, id)) {
        removeUserRoleMapping(id, UserManager.DEFAULT_SOURCE);
        return true;
      }
      return false;
    });
  }
  catch (OConcurrentModificationException e) {
    throw concurrentlyModified("User", id);
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:19,代码来源:OrientSecurityConfigurationSource.java

示例4: updatePrivilege

import com.orientechnologies.orient.core.exception.OConcurrentModificationException; //导入依赖的package包/类
@Override
public void updatePrivilege(final CPrivilege privilege) throws NoSuchPrivilegeException {
  checkNotNull(privilege);
  checkNotNull(privilege.getId());
  log.trace("Updating privilege: {}", privilege.getId());

  try {
    inTxRetry(databaseInstance).throwing(NoSuchPrivilegeException.class).run(db -> {
      CPrivilege existing = privilegeEntityAdapter.read(db, privilege.getId());
      if (existing == null) {
        throw new NoSuchPrivilegeException(privilege.getId());
      }
      if (!Objects.equals(privilege.getVersion(), existing.getVersion())) {
        throw concurrentlyModified("Privilege", privilege.getId());
      }
      privilegeEntityAdapter.update(db, privilege);
    });
  }
  catch (OConcurrentModificationException e) {
    throw concurrentlyModified("Privilege", privilege.getId());
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:23,代码来源:OrientSecurityConfigurationSource.java

示例5: updateRole

import com.orientechnologies.orient.core.exception.OConcurrentModificationException; //导入依赖的package包/类
@Override
public void updateRole(final CRole role) throws NoSuchRoleException {
  checkNotNull(role);
  checkNotNull(role.getId());
  log.trace("Updating role: {}", role.getId());

  try {
    inTxRetry(databaseInstance).throwing(NoSuchRoleException.class).run(db -> {
      CRole existing = roleEntityAdapter.read(db, role.getId());
      if (existing == null) {
        throw new NoSuchRoleException(role.getId());
      }
      if (!Objects.equals(role.getVersion(), existing.getVersion())) {
        throw concurrentlyModified("Role", role.getId());
      }
      roleEntityAdapter.update(db, role);
    });
  }
  catch (OConcurrentModificationException e) {
    throw concurrentlyModified("Role", role.getId());
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:23,代码来源:OrientSecurityConfigurationSource.java

示例6: updateUserRoleMapping

import com.orientechnologies.orient.core.exception.OConcurrentModificationException; //导入依赖的package包/类
@Override
public void updateUserRoleMapping(final CUserRoleMapping mapping) throws NoSuchRoleMappingException {
  checkNotNull(mapping);
  checkNotNull(mapping.getUserId());
  checkNotNull(mapping.getSource());
  log.trace("Updating user/role mappings for: {}/{}", mapping.getUserId(), mapping.getSource());

  try {
    inTxRetry(databaseInstance).throwing(NoSuchRoleMappingException.class).run(db -> {
      CUserRoleMapping existing = userRoleMappingEntityAdapter.read(db, mapping.getUserId(), mapping.getSource());
      if (existing == null) {
        throw new NoSuchRoleMappingException(mapping.getUserId());
      }
      if (!Objects.equals(mapping.getVersion(), existing.getVersion())) {
        throw concurrentlyModified("User-role mapping", mapping.getUserId());
      }
      userRoleMappingEntityAdapter.update(db, mapping);
    });
  }
  catch (OConcurrentModificationException e) {
    throw concurrentlyModified("User-role mapping", mapping.getUserId());
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:24,代码来源:OrientSecurityConfigurationSource.java

示例7: onRecordBeforeDelete

import com.orientechnologies.orient.core.exception.OConcurrentModificationException; //导入依赖的package包/类
@Override
public RESULT onRecordBeforeDelete(final ODocument iDocument) {
  final ORecordVersion version = iDocument.getRecordVersion(); // Cache the transaction-provided value
  if (iDocument.fields() == 0) {
    // FORCE LOADING OF CLASS+FIELDS TO USE IT AFTER ON onRecordAfterDelete METHOD
    iDocument.reload();
    if (version.getCounter() > -1 && iDocument.getRecordVersion().compareTo(version) != 0) // check for record version errors
      if (OFastConcurrentModificationException.enabled())
        throw OFastConcurrentModificationException.instance();
      else
        throw new OConcurrentModificationException(iDocument.getIdentity(), iDocument.getRecordVersion(), version,
            ORecordOperation.DELETED);
  }

  return RESULT.RECORD_NOT_CHANGED;
}
 
开发者ID:orientechnologies,项目名称:orientdb-lucene,代码行数:17,代码来源:OLuceneClassIndexManager.java

示例8: tx

import com.orientechnologies.orient.core.exception.OConcurrentModificationException; //导入依赖的package包/类
@Override
default <T> T tx(TxAction<T> txAction) {
	/**
	 * OrientDB uses the MVCC pattern which requires a retry of the code that manipulates the graph in cases where for example an
	 * {@link OConcurrentModificationException} is thrown.
	 */
	T handlerResult = null;
	boolean handlerFinished = false;
	for (int retry = 0; retry < getMaxRetry(); retry++) {

		try (Tx tx = tx()) {
			handlerResult = txAction.handle(tx);
			handlerFinished = true;
			tx.success();
		} catch (OConcurrentModificationException e) {
			try {
				// Delay the retry by 50ms to give the other transaction a chance to finish
				Thread.sleep(50 + (retry * 5));
			} catch (InterruptedException e1) {
				e1.printStackTrace();
			}
			// Reset previous result
			handlerFinished = false;
			handlerResult = null;
		}
		if (handlerFinished) {
			return handlerResult;
		}
	}
	throw new RuntimeException("Retry limit {" + getMaxRetry() + "} for trx exceeded");
}
 
开发者ID:Syncleus,项目名称:Ferma-OrientDB,代码行数:32,代码来源:OrientTransactionFactory.java

示例9: commit

import com.orientechnologies.orient.core.exception.OConcurrentModificationException; //导入依赖的package包/类
/**
     * Persistir la información pendiente en la transacción
     *
     * @throws NoOpenTx si no hay una trnasacción abierta.
     */
    public synchronized void commit() throws NoOpenTx, OConcurrentModificationException {
        
//        this.graphdb.getRawGraph().activateOnCurrentThread();

        // bajar todos los objetos a los vértices
        // this.commitObjectChanges();
        // cambiar el estado a comiteando
        this.publicTransaction.commit();
    }
 
开发者ID:mdre,项目名称:odbogm,代码行数:15,代码来源:SessionManager.java

示例10: removePrivilege

import com.orientechnologies.orient.core.exception.OConcurrentModificationException; //导入依赖的package包/类
@Override
public boolean removePrivilege(final String id) {
  checkNotNull(id);
  log.trace("Removing privilege: {}", id);

  try {
    return inTxRetry(databaseInstance).call(db -> privilegeEntityAdapter.delete(db, id));
  }
  catch (OConcurrentModificationException e) {
    throw concurrentlyModified("Privilege", id);
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:13,代码来源:OrientSecurityConfigurationSource.java

示例11: removeRole

import com.orientechnologies.orient.core.exception.OConcurrentModificationException; //导入依赖的package包/类
@Override
public boolean removeRole(final String id) {
  checkNotNull(id);
  log.trace("Removing role: {}", id);

  try {
    return inTxRetry(databaseInstance).call(db -> roleEntityAdapter.delete(db, id));
  }
  catch (OConcurrentModificationException e) {
    throw concurrentlyModified("Role", id);
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:13,代码来源:OrientSecurityConfigurationSource.java

示例12: removeUserRoleMapping

import com.orientechnologies.orient.core.exception.OConcurrentModificationException; //导入依赖的package包/类
@Override
public boolean removeUserRoleMapping(final String userId, final String source) {
  checkNotNull(userId);
  checkNotNull(source);
  log.trace("Removing user/role mappings for: {}/{}", userId, source);

  try {
    return inTxRetry(databaseInstance).call(db -> userRoleMappingEntityAdapter.delete(db, userId, source));
  }
  catch (OConcurrentModificationException e) {
    throw concurrentlyModified("User-role mapping", userId);
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:14,代码来源:OrientSecurityConfigurationSource.java

示例13: commit

import com.orientechnologies.orient.core.exception.OConcurrentModificationException; //导入依赖的package包/类
/**
     * Persistir la información pendiente en la transacción
     *
     * @throws NoOpenTx si no hay una trnasacción abierta.
     */
    public synchronized void commit() throws NoOpenTx, OConcurrentModificationException {
        if (this.nestedTransactionLevel == 0) {
            if (this.orientdbTransact == null) {
                throw new NoOpenTx();
            }
//        this.graphdb.getRawGraph().activateOnCurrentThread();

            // bajar todos los objetos a los vértices
            // this.commitObjectChanges();
            // cambiar el estado a comiteando
            this.commiting = true;
            LOGGER.log(Level.FINER, "Iniciando COMMIT ==================================");
            LOGGER.log(Level.FINER, "Objetos marcados como Dirty: " + dirty.size());
            for (Map.Entry<String, Object> e : dirty.entrySet()) {
                String rid = e.getKey();
                IObjectProxy o = (IObjectProxy) e.getValue();
                LOGGER.log(Level.FINER, "Commiting: " + rid + "   class: " + o.___getBaseClass()+" isValid: "+ o.___isValid());
                // actualizar todos los objetos antes de bajarlos.
                o.___commit();
            }
            LOGGER.log(Level.FINER, "Fin persistencia. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
            // comitear los vértices
            LOGGER.log(Level.FINER, "llamando al commit de la base");
            this.orientdbTransact.commit();
            LOGGER.log(Level.FINER, "finalizado.");

            // si se está en modalidad audit, grabar los logs
            if (this.isAuditing()) {
                LOGGER.log(Level.FINER, "grabando auditoría...");
                this.getAuditor().commit();
                this.orientdbTransact.commit();
                LOGGER.log(Level.FINER, "finalizado.");
            }
            // vaciar el caché de elementos modificados.
            this.dirty.clear();
            this.commiting = false;
            this.commitedObject.clear();

//        // refrescar las referencias del caché
//        String newRid;
//        for (Iterator<String> iterator = newrids.iterator(); iterator.hasNext();) {
//            String tempRid = iterator.next();
//            if (objectCache.get(tempRid).get()!=null) {
//                // reemplazar el rid con el que le asignó la base luego de persistir el objeto
//                Object o = objectCache.get(tempRid).get();
//                objectCache.remove(tempRid);
//                newRid = this.getRID(o);
//                objectCache.put(newRid, new WeakReference<>(o));
//            }
//        }
            // se opta por eliminar el caché de objetos recuperados de la base en un commit o rollback
            // por lo que futuros pedidos a la base fuera de la transacción devolverá una nueva instancia
            // del objeto.
            this.objectCache.clear();
            newrids.clear();
        } else {
            this.nestedTransactionLevel --;
        }
        LOGGER.log(Level.FINER, "FIN DE COMMIT! ----------------------------");
    }
 
开发者ID:mdre,项目名称:odbogm,代码行数:66,代码来源:Transaction.java

示例14: vary

import com.orientechnologies.orient.core.exception.OConcurrentModificationException; //导入依赖的package包/类
void vary(int retry, OConcurrentModificationException e); 
开发者ID:cstamas,项目名称:vertx-orientdb,代码行数:2,代码来源:OrientUtils.java


注:本文中的com.orientechnologies.orient.core.exception.OConcurrentModificationException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。