com.orientechnologies.orient.core.exception.ORecordNotFoundException Java Examples
The following examples show how to use
com.orientechnologies.orient.core.exception.ORecordNotFoundException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JobStoreImpl.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
/** * Execute read operation within transaction and propagate/translate exceptions. */ private <T> T executeRead(final Operation<T> operation) throws JobPersistenceException { storeLock.readLock().lock(); try { 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); } finally { storeLock.readLock().unlock(); } }
Example #2
Source File: JobStoreImpl.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
/** * Execute write operation within transaction and propagate/translate exceptions. */ private <T> T executeWrite(final Operation<T> operation) throws JobPersistenceException { storeLock.writeLock().lock(); try { 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); } finally { storeLock.writeLock().unlock(); } }
Example #3
Source File: JobStoreImpl.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@Override public List<OperableTrigger> acquireNextTriggers(final long noLaterThan, final int maxCount, final long timeWindow) throws JobPersistenceException { storeLock.writeLock().lock(); try { 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); } finally { storeLock.writeLock().unlock(); } }
Example #4
Source File: ODocumentModel.java From wicket-orientdb with Apache License 2.0 | 6 votes |
@Override protected ODocument load() { if(orid!=null && orid.isValid()) { try { ODatabaseDocument db = OrientDbWebSession.get().getDatabase(); return db.load(orid); } catch (ORecordNotFoundException e) { return null; } } else { return savedDocument; } }
Example #5
Source File: OrientNpmGroupFacet.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Nullable @Transactional(retryOn = ONeedRetryException.class, swallow = ORecordNotFoundException.class) protected void doInvalidate(final NpmPackageId packageId) { StorageTx tx = UnitOfWork.currentTx(); Bucket bucket = tx.findBucket(getRepository()); Asset asset = findPackageRootAsset(tx, bucket, packageId); if (nonNull(asset) && invalidateAsset(asset)) { tx.saveAsset(asset); } }
Example #6
Source File: OrientPyPiGroupFacet.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Transactional(retryOn = ONeedRetryException.class, swallow = ORecordNotFoundException.class) protected void doInvalidateCache(final String name) { StorageTx tx = UnitOfWork.currentTx(); Asset asset = tx.findAssetWithProperty(P_NAME, name, tx.findBucket(getRepository())); if (asset != null && invalidateAsset(asset)) { log.info("Invalidating cached content {} from {}", name, getRepository().getName()); tx.saveAsset(asset); } }
Example #7
Source File: OrientMavenGroupFacet.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
/** * Tries to invalidate the current main cached asset for the given {@link MavenPath}. */ @Transactional(retryOn = ONeedRetryException.class, swallow = ORecordNotFoundException.class) protected void doInvalidate(final MavenPath mavenPath) { StorageTx tx = UnitOfWork.currentTx(); final Asset asset = findAsset(tx, tx.findBucket(getRepository()), mavenPath.main()); if (asset != null && CacheInfo.invalidateAsset(asset)) { tx.saveAsset(asset); } }
Example #8
Source File: LastDownloadedHandler.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Transactional(swallow = { // silently skip if the record has been deleted, someone else updated it, or the system is in read-only mode ORecordNotFoundException.class, ONeedRetryException.class, OModificationOperationProhibitedException.class }) @VisibleForTesting protected void tryPersistLastDownloadedTime(final Asset asset) { StorageTx tx = UnitOfWork.currentTx(); // reload asset in case it's changed since it was stored in the response Asset latestAsset = tx.findAsset(EntityHelper.id(asset)); if (latestAsset != null && assetManager.maybeUpdateLastDownloaded(latestAsset)) { tx.saveAsset(latestAsset); } }
Example #9
Source File: ODocumentWrapperModel.java From wicket-orientdb with Apache License 2.0 | 5 votes |
@Override public T getObject() { try { T ret = super.getObject(); if(ret != null && needToReload) { ret.load(); needToReload = false; } return ret; } catch (ORecordNotFoundException e) { return null; } }
Example #10
Source File: OLuceneClassIndexManager.java From orientdb-lucene with Apache License 2.0 | 5 votes |
private static ODocument checkForLoading(final ODocument iRecord) { if (iRecord.getInternalStatus() == ORecordElement.STATUS.NOT_LOADED) { try { return (ODocument) iRecord.load(); } catch (final ORecordNotFoundException e) { throw new OIndexException("Error during loading of record with id : " + iRecord.getIdentity()); } } return iRecord; }
Example #11
Source File: OrientMavenGroupFacet.java From nexus-public with Eclipse Public License 1.0 | 2 votes |
/** * Attempts to delete previously cached content for the given {@link MavenPath}. * * Declare this method as transactional before calling the main facet as we want to * override the default semantics and let retry exceptions propagate to the caller. * We also want to avoid retrying if another thread concurrently works on the same * metadata path. */ @Transactional(swallow = ORecordNotFoundException.class) protected void deletePath(final MavenPath mavenPath) throws IOException { MavenFacetUtils.deleteWithHashes(mavenFacet, mavenPath); }