• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ONeedRetryException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: createSnapshot

import com.orientechnologies.common.concur.ONeedRetryException; //导入依赖的package包/类
@Transactional(retryOn = { ONeedRetryException.class })
@Override
public void createSnapshot(String id, SnapshotComponentSelector selector) throws IOException {
  StorageTx tx = UnitOfWork.currentTx();
  StorageFacet storageFacet = facet(StorageFacet.class);
  Bucket bucket = tx.findBucket(getRepository());
  Component component = tx.createComponent(bucket, getRepository().getFormat()).name(id);
  tx.saveComponent(component);
  for (SnapshotItem item : collectSnapshotItems(selector)) {
    String assetName = createAssetPath(id, item.specifier.path);
    Asset asset = tx.createAsset(bucket, component).name(assetName);
    try (final TempBlob streamSupplier = storageFacet.createTempBlob(item.content.openInputStream(), FacetHelper.hashAlgorithms)) {
      AssetBlob blob = tx.createBlob(item.specifier.path, streamSupplier, FacetHelper.hashAlgorithms, null,
          FacetHelper.determineContentType(item), true);
      tx.attachBlob(asset, blob);
    }
    finally {
      item.content.close();
    }
    tx.saveAsset(asset);
  }
}
 
开发者ID:sonatype-nexus-community,项目名称:nexus-repository-apt,代码行数:23,代码来源:AptSnapshotFacetSupport.java


示例2: getSnapshotFile

import com.orientechnologies.common.concur.ONeedRetryException; //导入依赖的package包/类
@Transactional(retryOn = { ONeedRetryException.class })
@Override
public Content getSnapshotFile(String id, String path) throws IOException {
  StorageTx tx = UnitOfWork.currentTx();
  Bucket bucket = tx.findBucket(getRepository());
  Component component = tx.findComponentWithProperty(P_NAME, id, bucket);
  if (component == null) {
    return null;
  }

  final Asset asset = tx.findAssetWithProperty(P_NAME, createAssetPath(id, path), component);
  if (asset == null) {
    return null;
  }
  if (asset.markAsDownloaded()) {
    tx.saveAsset(asset);
  }

  final Blob blob = tx.requireBlob(asset.requireBlobRef());
  return FacetHelper.toContent(asset, blob);
}
 
开发者ID:sonatype-nexus-community,项目名称:nexus-repository-apt,代码行数:22,代码来源:AptSnapshotFacetSupport.java


示例3: execute

import com.orientechnologies.common.concur.ONeedRetryException; //导入依赖的package包/类
/**
 * Execute operation within transaction and propagate/translate exceptions.
 */
private <T> T execute(final Operation<T> operation) throws JobPersistenceException {
  try {
    synchronized (monitor) {
      return inTx(databaseInstance)
          .retryOn(ONeedRetryException.class, ORecordNotFoundException.class)
          .throwing(JobPersistenceException.class)
          .call(operation::execute);
    }
  }
  catch (Exception e) {
    log.warn("Execution failed", e);
    Throwables.propagateIfPossible(e, JobPersistenceException.class);
    throw new JobPersistenceException(e.toString(), e);
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:19,代码来源:JobStoreImpl.java


示例4: acquireNextTriggers

import com.orientechnologies.common.concur.ONeedRetryException; //导入依赖的package包/类
@Override
public List<OperableTrigger> acquireNextTriggers(final long noLaterThan,
                                                 final int maxCount,
                                                 final long timeWindow)
    throws JobPersistenceException
{
  try {
    synchronized (monitor) {
      return inTx(databaseInstance)
          .retryOn(ONeedRetryException.class, ORecordNotFoundException.class)
          .call(db -> doAcquireNextTriggers(db, noLaterThan, maxCount, timeWindow));
    }
  }
  catch (RuntimeException e) {
    acquireNextTriggersSummarizer.log("Problem acquiring next triggers", e);
    try {
      Thread.sleep(10); // introduce small delay, otherwise quartz will immediately try again
    }
    catch (InterruptedException ignore) { // NOSONAR
      // ignored
    }
    throw new JobPersistenceException(e.toString(), e);
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:25,代码来源:JobStoreImpl.java


示例5: updateTaskStatus

import com.orientechnologies.common.concur.ONeedRetryException; //导入依赖的package包/类
/**
 * Update the status of task.status to newStatus. Update will be applied to database and the task object. 
 * @param newStatus
 * @param task
 * @return
 * @throws ObjectNotFoundException
 * @throws NdexException
 */
public Task updateTaskStatus(Status newStatus, Task task) throws ObjectNotFoundException, NdexException {
	ODocument doc = this.getRecordByUUID(task.getExternalId(), NdexClasses.Task);
	Status s = Status.valueOf((String)doc.field(NdexClasses.Task_P_status));
	if ( s != newStatus ) {
   		for	(int retry = 0;	retry <	NdexDatabase.maxRetries;	++retry)	{
   			try	{
   	    		doc.fields(NdexClasses.Task_P_status, newStatus,
     				   NdexClasses.ExternalObj_mTime, new Date()).save();
  				break;
   			} catch(ONeedRetryException	e)	{
   				doc.reload();
   			}
   		}
	}
	task.setStatus(newStatus);
	return task;
}
 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:26,代码来源:TaskDocDAO.java


示例6: purgeTask

import com.orientechnologies.common.concur.ONeedRetryException; //导入依赖的package包/类
public int purgeTask (UUID taskID) throws ObjectNotFoundException, NdexException {
    ODocument d = this.getRecordByUUID(taskID, NdexClasses.Task);
    boolean isDeleted = d.field(NdexClasses.ExternalObj_isDeleted);
 
    if ( isDeleted ) {
        OrientVertex v = graph.getVertex(d);
			   
 		for	(int retry = 0;	retry <	NdexDatabase.maxRetries;	++retry)	{
 			try	{
	   			v.remove();
	   			break;
 			} catch(ONeedRetryException	e)	{
 				logger.warning("Write conflict when deleting task. Error: " + e.getMessage() +
					"\nRetry ("+ retry + ") deleting task " + taskID.toString() );
 				v.reload();
 			}
 		}
	
 		return 1;
    } 
    
    throw new NdexException ("Only deleted tasks can be purged.");
    
}
 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:25,代码来源:TaskDAO.java


示例7: cleanupDeleteNetwork

import com.orientechnologies.common.concur.ONeedRetryException; //导入依赖的package包/类
/** 
 * Delete up to CLEANUP_BATCH_SIZE vertices in a network. This function is for cleaning up a logically 
 * deleted network in the database. 
 * @param uuid
 * @return Number of vertices being deleted. If the returned number is negative, it means the elements
 * of the network are not completely deleted yet, and the number of vertices deleted are abs(returned number).
 * @throws ObjectNotFoundException
 * @throws NdexException
 */
public int cleanupDeleteNetwork(String uuid) throws ObjectNotFoundException, NdexException {
	ODocument networkDoc = getRecordByUUID(UUID.fromString(uuid), NdexClasses.Network);
	
	int count = cleanupNetworkElements(networkDoc);
	if ( count >= CLEANUP_BATCH_SIZE) {
		return (-1) * count;
	}
	
	// remove the network node.
	networkDoc.reload();
	
	for	(int retry = 0;	retry <	NdexDatabase.maxRetries;	++retry)	{
		try	{
			graph.removeVertex(graph.getVertex(networkDoc));
			break;
		} catch(ONeedRetryException	e)	{
			logger.warning("Retry: "+ e.getMessage());
			networkDoc.reload();
		}
	}
	
	return count++;
}
 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:33,代码来源:NetworkDAO.java


示例8: cleanupElement

import com.orientechnologies.common.concur.ONeedRetryException; //导入依赖的package包/类
private int cleanupElement(ODocument doc, int currentCount) {
	int counter = currentCount;
	doc.reload();

	for	(int retry = 0;	retry <	NdexDatabase.maxRetries;	++retry)	{
		try	{
			graph.removeVertex(graph.getVertex(doc));
			break;
		} catch(ONeedRetryException	e)	{
			logger.warning("Retry: "+ e.getMessage());
			doc.reload();
		}
	}
	counter ++;
	if ( counter % 2000 == 0 ) {
		graph.commit();
		if (counter % 10000 == 0 ) {
			logger.info("Deleted " + counter + " vertexes from network during cleanup.");
		}
	}
	return counter;
}
 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:23,代码来源:NetworkDAO.java


示例9: doInTXWithRetry

import com.orientechnologies.common.concur.ONeedRetryException; //导入依赖的package包/类
public void doInTXWithRetry(DBOperation operation, int maxRetries) throws Exception {
    OrientGraph graph = graph();
    for (int retry = 0; retry < maxRetries; ++retry) {
        try {
            operation.execute(graph);
            graph.commit();
            break;
        } catch (ONeedRetryException e) {
            // SOMEONE HAVE UPDATE THE INVOICE VERTEX AT THE SAME TIME, RETRY IT
        }
    }
}
 
开发者ID:imotSpot,项目名称:imotSpot,代码行数:13,代码来源:OrientDBServer.java


示例10: doIndicateVerified

import com.orientechnologies.common.concur.ONeedRetryException; //导入依赖的package包/类
@Transactional(retryOn = { ONeedRetryException.class })
protected void doIndicateVerified(Content content, CacheInfo cacheInfo, String assetPath) {
  StorageTx tx = UnitOfWork.currentTx();
  Bucket bucket = tx.findBucket(getRepository());

  Asset asset = Content.findAsset(tx, bucket, content);
  if (asset == null) {
    asset = tx.findAssetWithProperty(P_NAME, assetPath, bucket);
  }
  if (asset == null) {
    return;
  }
  CacheInfo.applyToAsset(asset, cacheInfo);
  tx.saveAsset(asset);
}
 
开发者ID:sonatype-nexus-community,项目名称:nexus-repository-apt,代码行数:16,代码来源:AptProxyFacet.java


示例11: deleteSnapshot

import com.orientechnologies.common.concur.ONeedRetryException; //导入依赖的package包/类
@Transactional(retryOn = { ONeedRetryException.class })
@Override
public void deleteSnapshot(String id) throws IOException {
  StorageTx tx = UnitOfWork.currentTx();
  Bucket bucket = tx.findBucket(getRepository());
  Component component = tx.findComponentWithProperty(P_NAME, id, bucket);
  if (component == null) {
    return;
  }
  tx.deleteComponent(component);
}
 
开发者ID:sonatype-nexus-community,项目名称:nexus-repository-apt,代码行数:12,代码来源:AptSnapshotFacetSupport.java


示例12: createComponentNode

import com.orientechnologies.common.concur.ONeedRetryException; //导入依赖的package包/类
@Override
@Guarded(by = STARTED)
public void createComponentNode(final String repositoryName, final List<String> path, final Component component) {
  inTxRetry(databaseInstance)
      // handle case where assets try to create the exact same component-level path at once
      .retryOn(ONeedRetryException.class, ORecordDuplicatedException.class)
      .run(db -> entityAdapter.createComponentNode(db, repositoryName, path, component));
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:9,代码来源:BrowseNodeStoreImpl.java


示例13: createAssetNode

import com.orientechnologies.common.concur.ONeedRetryException; //导入依赖的package包/类
@Override
@Guarded(by = STARTED)
public void createAssetNode(final String repositoryName, final List<String> path, final Asset asset) {
  inTxRetry(databaseInstance)
      // handle case where an asset and its component try to create the exact same path at once
      .retryOn(ONeedRetryException.class, ORecordDuplicatedException.class)
      .run(db -> entityAdapter.createAssetNode(db, repositoryName, path, asset));
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:9,代码来源:BrowseNodeStoreImpl.java


示例14: isRetryException

import com.orientechnologies.common.concur.ONeedRetryException; //导入依赖的package包/类
/**
 * Searching for {@link com.orientechnologies.common.concur.ONeedRetryException} in exception hierarchy.
 *
 * @param th thrown exception
 * @return true if retry could be performed
 */
private boolean isRetryException(final Throwable th) {
    Throwable current = th;
    boolean res = false;
    while (current != null) {
        if (current instanceof ONeedRetryException) {
            res = true;
            break;
        }
        current = current.getCause();
    }
    return res;
}
 
开发者ID:xvik,项目名称:guice-persist-orient,代码行数:19,代码来源:RetryMethodInterceptor.java


示例15: deleteTask

import com.orientechnologies.common.concur.ONeedRetryException; //导入依赖的package包/类
public int deleteTask (UUID taskID) throws ObjectNotFoundException, NdexException {
    ODocument d = this.getRecordByUUID(taskID, NdexClasses.Task);
   
	for	(int retry = 0;	retry <	NdexDatabase.maxRetries;	++retry)	{
		try	{
	        d.fields(NdexClasses.ExternalObj_isDeleted,  true, 
        		 NdexClasses.ExternalObj_mTime, new Date()).save();
		break;
		} catch(ONeedRetryException	e)	{
			d.reload();
		}
	}
	
	return 1;		           
}
 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:16,代码来源:TaskDocDAO.java


示例16: cleanupElement

import com.orientechnologies.common.concur.ONeedRetryException; //导入依赖的package包/类
private void cleanupElement(ODocument doc) {
		doc.reload();

		for	(int retry = 0;	retry <	NdexDatabase.maxRetries;	++retry)	{
			try	{
				graph.removeVertex(graph.getVertex(doc));
				break;
			} catch(ONeedRetryException	e)	{
//				logger.warning("Retry: "+ e.getMessage());
				doc.reload();
			}
		}
	}
 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:14,代码来源:SingleNetworkDAO.java


示例17: indicateVerified

import com.orientechnologies.common.concur.ONeedRetryException; //导入依赖的package包/类
@Transactional(retryOn = { ONeedRetryException.class })
@Override
protected void indicateVerified(Context context, Content content, CacheInfo cacheInfo) throws IOException {
  doIndicateVerified(content, cacheInfo, assetPath(context));
}
 
开发者ID:sonatype-nexus-community,项目名称:nexus-repository-apt,代码行数:6,代码来源:AptProxyFacet.java


示例18: createTask

import com.orientechnologies.common.concur.ONeedRetryException; //导入依赖的package包/类
public UUID createTask(String accountName, Task newTask) throws ObjectNotFoundException, NdexException {
	
	if (newTask.getExternalId() == null)
		newTask.setExternalId(NdexUUIDFactory.INSTANCE.createNewNDExUUID());
	
	ODocument taskDoc = new ODocument(NdexClasses.Task)
			.fields(NdexClasses.ExternalObj_ID, newTask.getExternalId().toString(),
				NdexClasses.ExternalObj_cTime, newTask.getCreationTime(),
				NdexClasses.ExternalObj_mTime, newTask.getModificationTime(),
				NdexClasses.Task_P_description, newTask.getDescription(),
				NdexClasses.Task_P_status, newTask.getStatus(),
				NdexClasses.Task_P_priority, newTask.getPriority(),
				NdexClasses.Task_P_progress, newTask.getProgress(),
				NdexClasses.Task_P_taskType, newTask.getTaskType(),
				NdexClasses.Task_P_resource, newTask.getResource(),
				NdexClasses.ExternalObj_isDeleted, false,
				NdexClasses.Task_P_startTime, newTask.getStartTime(),
				NdexClasses.Task_P_endTime, newTask.getFinishTime(),
				NdexClasses.Task_P_message, newTask.getMessage());

	if ( newTask.getFormat() != null) 
		taskDoc = taskDoc.field(NdexClasses.Task_P_fileFormat, newTask.getFormat());
	
	if ( newTask.getAttributes() != null ) {
		taskDoc = taskDoc.field(NdexClasses.Task_P_attributes, newTask.getAttributes());
	}
	
	taskDoc = taskDoc.save();
	
	if ( accountName != null) {
		ODocument userDoc = getRecordByAccountName(accountName, NdexClasses.User);
		
		String userUUID = userDoc.field(NdexClasses.ExternalObj_ID);

		taskDoc = taskDoc.field("ownerUUID", userUUID).save();
		
		OrientVertex taskV = graph.getVertex(taskDoc);
		
		OrientVertex userV = this.graph.getVertex(userDoc.reload());
		for	(int retry = 0;	retry <	NdexDatabase.maxRetries;	++retry)	{
			try	{
				taskV.addEdge(NdexClasses.Task_E_owner, userV );

				break;
			} catch(ONeedRetryException	e)	{
				logger.warning("Retry creating task add edge.");
				taskV.reload();
				taskV.getRecord().removeField("out_"+ NdexClasses.Task_E_owner);
				userV.reload();
			}
		}
		newTask.setTaskOwnerId(UUID.fromString(userUUID));
		graph.commit();
		NdexServerQueue.INSTANCE.addUserTask(newTask);
	}
	
	return newTask.getExternalId();
	
}
 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:60,代码来源:TaskDAO.java


示例19: revokePrivilege

import com.orientechnologies.common.concur.ONeedRetryException; //导入依赖的package包/类
public int revokePrivilege(String networkUUID, String accountUUID) throws NdexException, SolrServerException, IOException {
  	// check if the edge exists?

  	Permissions p = Helper.getNetworkPermissionByAccout(this.db,networkUUID, accountUUID);

      if ( p ==null ) {
      	logger.info("Permission doesn't exists between account " + accountUUID + 
      			 " and network " + networkUUID + ". Igore revoke request."); 
      	return 0;
      }
      
      //check if this network has other admins
      if ( p == Permissions.ADMIN && !Helper.canRemoveAdmin(this.db, networkUUID, accountUUID)) {
      	
      	throw new NdexException ("Privilege revoke failed. Network " + networkUUID +" only has account " + accountUUID
      			+ " as the administrator.");
      }
      
      ODocument networkdoc = this.getNetworkDocByUUID(UUID.fromString(networkUUID));
      ODocument accountdoc = this.getRecordByUUID(UUID.fromString(accountUUID), null);
      
      String className = accountdoc.getClassName();
      String accountName = accountdoc.field(NdexClasses.account_P_accountName);
      OrientVertex networkV = graph.getVertex(networkdoc);
      OrientVertex accountV = graph.getVertex(accountdoc);
      
      for ( com.tinkerpop.blueprints.Edge e : accountV.getEdges(networkV, Direction.OUT)) { 
      	
  		for	(int retry = 0;	retry <	NdexDatabase.maxRetries;	++retry)	{
  			try	{
  	          	graph.removeEdge(e);
  				break;
  			} catch(ONeedRetryException	ex)	{
  				logger.warning("Retry removing edge between account and network: " + ex.getMessage());
  		       networkV.reload();
  		       accountV.reload();
  			}
  		}
        	break;
      }

//update solr index
NetworkGlobalIndexManager networkIdx = new NetworkGlobalIndexManager();
networkIdx.revokeNetworkPermission(networkUUID, accountName, p, 
		className.equals(NdexClasses.User));
      
      
  	return 1;
  }
 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:50,代码来源:NetworkDAO.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EntityIronGolem类代码示例发布时间:2022-05-23
下一篇:
Java ApplicationAttemptStartDataPBImpl类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap