Examples of ConcurrencyException


Examples of org.apache.isis.runtimes.dflt.runtime.persistence.ConcurrencyException

    @Override
    public void checkLock(final Version version) {
        if (this.version != null && this.version.different(version)) {
            LOG.info("concurrency conflict on " + this + " (" + version + ")");
            throw new ConcurrencyException(this, version);
        }
    }
View Full Code Here

Examples of org.apache.isis.runtimes.dflt.runtime.persistence.ConcurrencyException

        sql.append(" AND ");
        sql.append(versionMapping.whereClause(connector, (SerialNumberVersion) object.getVersion()));
        final int updateCount = connector.update(sql.toString());
        if (updateCount == 0) {
            LOG.info("concurrency conflict object " + this + "; no deletion performed");
            throw new ConcurrencyException("", object.getOid());
        }
    }
View Full Code Here

Examples of org.apache.isis.runtimes.dflt.runtime.persistence.ConcurrencyException

        sql.append(versionMapping.whereClause(connector, (SerialNumberVersion) object.getVersion()));

        final int updateCount = connector.update(sql.toString());
        if (updateCount == 0) {
            LOG.info("concurrency conflict object " + this + "; no update performed");
            throw new ConcurrencyException("", object.getOid());
        } else {
            object.setOptimisticLock(createVersion(nextSequence));
        }

        // TODO update collections - change only when needed rather than
View Full Code Here

Examples of org.apache.isis.runtimes.dflt.runtime.persistence.ConcurrencyException

            throw new ObjectNotFoundException(message);
        } else if (status.equals("concurrency")) {
            final String data = getResponseData();
            // TODO create better exceptions (requires way to restore object/version)
            if (data.startsWith("{")) {
                throw new ConcurrencyException(data, (Throwable) null);

            } else {
                throw new ConcurrencyException(data, (Throwable) null);

            }
        } else if (!status.equals("ok")) {
            throw new RemotingException("Invalid status in response: " + status);
        }
View Full Code Here

Examples of org.axonframework.repository.ConcurrencyException

        jedis.watch(key);
        Long eventCount = jedis.llen(key);
        if ((firstEvent.getSequenceNumber() != 0 && eventCount == null)
                || firstEvent.getSequenceNumber() != eventCount) {
            jedis.unwatch();
            throw new ConcurrencyException(
                    String.format("Concurrent modification detected for Aggregate identifier [%s], sequence: [%s]",
                                  firstEvent.getAggregateIdentifier(),
                                  firstEvent.getSequenceNumber()));
        }
View Full Code Here

Examples of org.axonframework.repository.ConcurrencyException

            entityManager.flush();
        } catch (RuntimeException exception) {
            if (event != null
                    && persistenceExceptionResolver != null
                    && persistenceExceptionResolver.isDuplicateKeyViolation(exception)) {
                throw new ConcurrencyException(
                        String.format("Concurrent modification detected for Aggregate identifier [%s], sequence: [%s]",
                                      event.getAggregateIdentifier(),
                                      event.getSequenceNumber()),
                        exception);
            }
View Full Code Here

Examples of org.axonframework.repository.ConcurrencyException

            entityManager.flush();
        } catch (RuntimeException exception) {
            if (snapshotEvent != null
                    && persistenceExceptionResolver != null
                    && persistenceExceptionResolver.isDuplicateKeyViolation(exception)) {
                throw new ConcurrencyException(
                        String.format("A snapshot for aggregate [%s] at sequence: [%s] was already inserted",
                                      snapshotEvent.getAggregateIdentifier(),
                                      snapshotEvent.getSequenceNumber()),
                        exception);
            }
View Full Code Here

Examples of org.axonframework.repository.ConcurrencyException

            }
        } catch (RuntimeException exception) {
            if (persistenceExceptionResolver != null
                    && persistenceExceptionResolver.isDuplicateKeyViolation(exception)) {
                //noinspection ConstantConditions
                throw new ConcurrencyException(
                        String.format("Concurrent modification detected for Aggregate identifier [%s], sequence: [%s]",
                                      event.getAggregateIdentifier(),
                                      event.getSequenceNumber()),
                        exception
                );
View Full Code Here

Examples of org.axonframework.repository.ConcurrencyException

            eventEntryStore.persistSnapshot(type, snapshotEvent, serializedPayload, serializedMetaData);
        } catch (RuntimeException exception) {
            if (persistenceExceptionResolver != null
                    && persistenceExceptionResolver.isDuplicateKeyViolation(exception)) {
                //noinspection ConstantConditions
                throw new ConcurrencyException(
                        String.format("A snapshot for aggregate [%s] at sequence: [%s] was already inserted",
                                      snapshotEvent.getAggregateIdentifier(),
                                      snapshotEvent.getSequenceNumber()),
                        exception
                );
View Full Code Here

Examples of org.axonframework.repository.ConcurrencyException

        try {
            mongoTemplate.domainEventCollection().insert(storageStrategy.createDocuments(type,
                                                                                         eventSerializer,
                                                                                         messages));
        } catch (MongoException.DuplicateKey e) {
            throw new ConcurrencyException("Trying to insert an Event for an aggregate with a sequence "
                                                   + "number that is already present in the Event Store", e);
        }

        if (logger.isDebugEnabled()) {
            logger.debug("{} events appended", new Object[]{messages.size()});
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.