/** * Executes the work with a specified number of retries with a specified number of milliseconds delay between * each try. * * @param exceptionsToRetryOn For a retry to happen, it must be in this set of accepted exceptions. If an * exception raises that is not in the set, then an error is immediately raised * with no retry. */ public T retry(final int retries, final long delayBetweenRetries, final Set<Class> exceptionsToRetryOn ) { return use(new TransactionRetryStrategy.DelayedRetry<T>(retries, delayBetweenRetries, exceptionsToRetryOn)); }
/** * Executes the work with a specified number of retries with a exponentially increasing number of milliseconds * between each retry. */ public T exponentialBackoff(final int retries) { return use(new TransactionRetryStrategy.ExponentialBackoff<T>( retries, TransactionRetryStrategy.ExponentialBackoff.DEFAULT_DELAY_MS)); }
/** * Executes the work committing if possible and rolling back on failure. On failure, not exception is reported. */ public T fireAndForget() { return use(new TransactionRetryStrategy.FireAndForget<T>()); }
public String getVertexId(Direction direction) throws IllegalArgumentException { switch (direction) { case IN: return destinationId; case OUT: return sourceId; case BOTH: default: throw ExceptionFactory.bothIsNotSupported(); } }
/** * Test whether the two vertices have equal properties and edge sets. * * @param a the first vertex * @param b the second vertex * @param checkIdEquality whether to check on vertex and edge ids * @return whether the two vertices are semantically the same */ public static boolean haveEqualNeighborhood(final Vertex a, final Vertex b, final boolean checkIdEquality) { if (checkIdEquality && !ElementHelper.haveEqualIds(a, b)) return false; return ElementHelper.haveEqualProperties(a, b) && haveEqualEdges(a, b, checkIdEquality); }
/** * Executes the work committing if possible and rolling back on failure. On failure an exception is reported. */ public T oneAndDone() { return use(new TransactionRetryStrategy.OneAndDone<T>()); }
public GraphQuery hasNot(final String key, final Object value) { super.hasNot(key, value); return this; }
public boolean hasNext() { if (null != this.nextElement) { return true; } else { return this.loadNext(); } }
public boolean hasNext() { if (null != this.nextEdge) { return true; } else { return this.loadNext(); } }
public long count() { long count = 0; for (final Edge edge : this.edges()) { count++; } return count; }
/** * Executes the work with a specified TransactionRetryStrategy. */ public T use(final TransactionRetryStrategy<T> strategy) { return strategy.execute(this.graph, this.work); }
public GraphQuery limit(final int limit) { super.limit(limit); return this; }
public <T extends Comparable<T>> VertexQuery has(final String key, final T value, final Compare compare) { super.has(key, compare, value); return this; }
/** * Executes the work with a default number of retries with a default number of milliseconds delay between * each try. */ public T retry() { return use(new TransactionRetryStrategy.DelayedRetry<T>()); }
/** * Executes the work with a specified number of retries with a exponentially increasing number of milliseconds * between each retry. * * @param exceptionsToRetryOn For a retry to happen, it must be in this set of accepted exceptions. If an * exception raises that is not in the set, then an error is immediately raised * with no retry. */ public T exponentialBackoff(final int retries, final long initialDelay, final Set<Class> exceptionsToRetryOn) { return use(new TransactionRetryStrategy.ExponentialBackoff<T>( retries, initialDelay, exceptionsToRetryOn)); }
public VertexQuery hasNot(final String key, final Object value) { super.hasNot(key, value); return this; }
/** * Executes the work with a specified number of retries with a specified number of milliseconds delay between * each try. */ public T retry(final int retries, final long delayBetweenRetries) { return use(new TransactionRetryStrategy.DelayedRetry<T>(retries, delayBetweenRetries)); }
/** * Executes the work with a specified number of retries with a exponentially increasing number of milliseconds * between each retry. */ public T exponentialBackoff(final int retries, final long initialDelay) { return use(new TransactionRetryStrategy.ExponentialBackoff<T>( retries, initialDelay)); }
/** * Executes the work with a specified number of retries with a default number of milliseconds delay between * each try. */ public T retry(final int retries) { return use(new TransactionRetryStrategy.DelayedRetry<T>(retries, TransactionRetryStrategy.DelayedRetry.DEFAULT_DELAY_MS)); }
/** * Executes the work with a default number of retries with a exponentially increasing number of milliseconds * between each retry. */ public T exponentialBackoff() { return use(new TransactionRetryStrategy.ExponentialBackoff<T>()); }