private void checkVerificationFails(PersistenceManager pm1, Object ...oids) { try { pm1.checkConsistency(); if (oids.length > 0) { fail("" + Arrays.toString(oids)); } } catch (JDOOptimisticVerificationException e) { //good! HashSet<Object> failedOids = new HashSet<>(); for (Throwable t: e.getNestedExceptions()) { Object f = ((JDOOptimisticVerificationException)t).getFailedObject(); failedOids.add(JDOHelper.getObjectId(f)); } assertEquals(oids.length, failedOids.size()); for (Object oid: oids) { assertTrue(failedOids.contains(oid)); } } } }
throw new JDOOptimisticVerificationException(LOCALISER.msg("PM.OptimisticVerificationError"), (Throwable[])optimisticFailures.toArray(new Throwable[optimisticFailures.size()]));
public JdoOptimisticLockingFailureException(JDOOptimisticVerificationException ex) { // Extract information about the failed object from the JDOException, if available. super((ex.getFailedObject() != null ? ex.getFailedObject().getClass() : null), (ex.getFailedObject() != null ? JDOHelper.getObjectId(ex.getFailedObject()) : null), ex.getMessage(), ex); }
@Override public void refreshAll(JDOException arg0) { DBTracer.logCall(this, arg0); checkOpen(); //We can't use HashSet because it may call an object's hashCode() and activateRead(). ObjectIdentitySet<Object> failed = new ObjectIdentitySet<>(); for (Throwable t: arg0.getNestedExceptions()) { Object f = ((JDOOptimisticVerificationException)t).getFailedObject(); failed.add(f); } nativeConnection.refreshAll(failed); }
protected void repeatUntilSuccess(RepeatableMethod m) { while (true) { try { m.run(); return; } catch (JDOOptimisticVerificationException e) { pm.currentTransaction().begin(); n -= COMMIT_INTERVAL; assertTrue(e.getNestedExceptions().length >= 1); assertTrue(e.getNestedExceptions().length <= N); } } } }
for (Throwable t: e.getNestedExceptions()) { Object f = ((JDOOptimisticVerificationException)t).getFailedObject(); failedOids.add(JDOHelper.getObjectId(f)); for (Throwable t: e.getNestedExceptions()) { Object f = ((JDOOptimisticVerificationException)t).getFailedObject(); failedObjects.add(f);
public JdoOptimisticLockingFailureException(JDOOptimisticVerificationException ex) { // extract information about the failed object from the JDOException, if available super((ex.getFailedObject() != null ? ex.getFailedObject().getClass() : null), (ex.getFailedObject() != null ? JDOHelper.getObjectId(ex.getFailedObject()) : null), ex.getMessage(), ex); }
private void processOptimisticTransactionResult(OptimisticTransactionResult otr) { if (otr.requiresReset()) { isActive = false; closeInternal(); throw DBLogger.newFatalDataStore( "Database schema has changed, please reconnect. ", null); } if (otr.requiresRefresh()) { if (schemaManager.hasChanges()) { //remote index update & local schema updates (could be index) --> considered bad! throw new JDOOptimisticVerificationException("Optimistic verification failed " + "because schema changes occurred in remote concurrent sessions."); } // refresh schema, this works only for indexes schemaManager.refreshSchemaAll(); } }
for (Throwable t: e.getNestedExceptions()) { Object f = ((JDOOptimisticVerificationException)t).getFailedObject(); failedOids.add(JDOHelper.getObjectId(f));
ea[pos] = new JDOOptimisticVerificationException(Util.oidToString(oid), failedObj); pos++; throw new JDOOptimisticVerificationException("Optimistic verification failed", ea);
for (Throwable t: e.getNestedExceptions()) { Object f = ((JDOOptimisticVerificationException)t).getFailedObject(); failedOids.add(JDOHelper.getObjectId(f));
throw new JDOOptimisticVerificationException(ne.getMessage(), jdoNested);
for (Throwable t: e.getNestedExceptions()) { Object f = ((JDOOptimisticVerificationException)t).getFailedObject(); assertTrue(f instanceof ZooHandle); failedOids.add(JDOHelper.getObjectId(f));
jdoNested[i] = (JDOOptimisticVerificationException) NucleusJDOHelper.getJDOExceptionForNucleusException(nested); throw new JDOOptimisticVerificationException(ne.getMessage(), jdoNested); throw new JDOOptimisticVerificationException(ne.getMessage(), jdoNested);
for (Throwable t: e.getNestedExceptions()) { Object f = ((JDOOptimisticVerificationException)t).getFailedObject(); failedOids.add(JDOHelper.getObjectId(f));
sm.getInternalObjectId(), table.toString(), datastoreVersion, sm.getTransactionalVersion(sm.getObject())); JPOXLogger.RDBMS.error(msg); throw new JDOOptimisticVerificationException(msg, sm.getObject()); sm.getInternalObjectId(), table.toString()); JPOXLogger.RDBMS.error(msg); throw new JDOOptimisticVerificationException(msg, sm.getObject());
for (Throwable t: e.getNestedExceptions()) { Object f = ((JDOOptimisticVerificationException)t).getFailedObject(); failedOids.add(JDOHelper.getObjectId(f));
sm.getInternalObjectId(), table.toString(), datastoreVersion, sm.getTransactionalVersion(sm.getObject())); JPOXLogger.RDBMS.error(msg); throw new JDOOptimisticVerificationException(msg, sm.getObject()); sm.getInternalObjectId(), table.toString()); JPOXLogger.RDBMS.error(msg); throw new JDOOptimisticVerificationException(msg, sm.getObject());
for (Throwable t: e.getNestedExceptions()) { Object f = ((JDOOptimisticVerificationException)t).getFailedObject(); failedOids.add(JDOHelper.getObjectId(f));
return new JDOOptimisticVerificationException(ne.getMessage(), ne.getFailedObject()); return new JDOOptimisticVerificationException(ne.getMessage(), ne.getNestedExceptions()); return new JDOOptimisticVerificationException(ne.getMessage(), ne);