Codota Logo
Segment.getSegmentId
Code IndexAdd Codota to your IDE (free)

How to use
getSegmentId
method
in
org.axonframework.eventhandling.Segment

Best Java code snippets using org.axonframework.eventhandling.Segment.getSegmentId (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Gson g =
  • Codota Iconnew Gson()
  • Codota IconGsonBuilder gsonBuilder;gsonBuilder.create()
  • Codota Iconnew GsonBuilder().create()
  • Smart code suggestions by Codota
}
origin: AxonFramework/AxonFramework

/**
 * Indicates whether this segment can be merged with the given {@code other} segment.
 * <p>
 * Two segments can be merged when their mask is identical, and the only difference in SegmentID is in the first
 * 1-bit of their mask.
 *
 * @param other the Segment to verify mergeability for
 * @return {@code true} if the segments can be merged, otherwise {@code false}
 */
public boolean isMergeableWith(Segment other) {
  return this.mask == other.mask
      && mergeableSegmentId() == other.getSegmentId();
}
origin: AxonFramework/AxonFramework

@Override
public String toString() {
  return String.format("Segment[%d/%s]", getSegmentId(), getMask());
}
origin: AxonFramework/AxonFramework

private static boolean computeSegments(Segment segment, List<Integer> segments, Set<Segment> applicableSegments) {
  final Segment[] splitSegment = segment.split();
  // As the first segmentId mask, keeps the original segmentId, we only check the 2nd segmentId mask being a know.
  if (segments.contains(splitSegment[1].getSegmentId())) {
    for (Segment segmentSplit : splitSegment) {
      if (!computeSegments(segmentSplit, segments, applicableSegments)) {
        applicableSegments.add(segmentSplit);
      }
    }
  } else {
    applicableSegments.add(segment);
  }
  return true;
}
origin: AxonFramework/AxonFramework

private void checkSegmentCaughtUp(Segment segment, BlockingStream<TrackedEventMessage<?>> eventStream) {
  if (!eventStream.hasNextAvailable()) {
    activeSegments.computeIfPresent(segment.getSegmentId(), (k, v) -> v.caughtUp());
  }
}
origin: AxonFramework/AxonFramework

@Override
public void run() {
  try {
    processingLoop(segment);
  } catch (Throwable e) {
    logger.error("Processing loop ended due to uncaught exception. Pausing processor in Error State.", e);
    state.set(State.PAUSED_ERROR);
  } finally {
    activeSegments.remove(segment.getSegmentId());
    if (availableThreads.getAndIncrement() == 0 && getState().isRunning()) {
      logger.info("No Worker Launcher active. Using current thread to assign segments.");
      new WorkerLauncher().run();
    }
  }
}
origin: AxonFramework/AxonFramework

private void releaseToken(Segment segment) {
  try {
    transactionManager.executeInTransaction(() -> tokenStore.releaseClaim(getName(), segment.getSegmentId()));
  } catch (Exception e) {
    // Ignore exception
  }
}
origin: AxonFramework/AxonFramework

private BlockingStream<TrackedEventMessage<?>> ensureEventStreamOpened(
    BlockingStream<TrackedEventMessage<?>> eventStreamIn, Segment segment) {
  BlockingStream<TrackedEventMessage<?>> eventStream = eventStreamIn;
  if (eventStream == null && state.get().isRunning()) {
    final TrackingToken trackingToken = transactionManager.fetchInTransaction(
        () -> tokenStore.fetchToken(getName(), segment.getSegmentId())
    );
    logger.info("Fetched token: {} for segment: {}", trackingToken, segment);
    eventStream = transactionManager.fetchInTransaction(
        () -> doOpenStream(trackingToken));
  }
  return eventStream;
}
origin: AxonFramework/AxonFramework

Segment segment = segments[i];
if (!activeSegments.containsKey(segment.getSegmentId())
    && canClaimSegment(segment.getSegmentId())) {
  try {
    transactionManager.executeInTransaction(() -> {
      TrackingToken token = tokenStore.fetchToken(processorName, segment.getSegmentId());
      activeSegments.putIfAbsent(segment.getSegmentId(), new TrackerStatus(segment, token));
    });
  } catch (UnableToClaimTokenException ucte) {
           segment.getSegmentId());
    activeSegments.remove(segment.getSegmentId());
    continue;
  } catch (Exception e) {
    activeSegments.remove(segment.getSegmentId());
    if (AxonNonTransientException.isCauseOf(e)) {
      logger.error(
          "An unrecoverable error has occurred wile attempting to claim a token "
              + "for segment: {}. Shutting down processor [{}].",
          segment.getSegmentId(),
          getName(),
        "An error occurred while attempting to claim a token for segment: {}. "
            + "Will retry later...",
        segment.getSegmentId(),
origin: AxonFramework/AxonFramework

long errorWaitTime = 1;
try {
  while (state.get().isRunning() && canClaimSegment(segment.getSegmentId())) {
    try {
      eventStream = ensureEventStreamOpened(eventStream, segment);
    } catch (UnableToClaimTokenException e) {
      logger.info("Segment is owned by another node. Releasing thread to process another segment...");
      releaseSegment(segment.getSegmentId());
    } catch (Exception e) {
origin: AxonFramework/AxonFramework

      TrackingToken finalLastToken = lastToken;
      transactionManager.executeInTransaction(
          () -> tokenStore.storeToken(finalLastToken, getName(), segment.getSegmentId())
      );
      activeSegments.computeIfPresent(segment.getSegmentId(), (k, v) -> v.advancedTo(finalLastToken));
      return;
        () -> tokenStore.extendClaim(getName(), segment.getSegmentId())
    );
    return;
  unitOfWork.resources().put(segmentIdResourceKey, segment.getSegmentId());
  unitOfWork.resources().put(lastTokenResourceKey, finalLastToken);
  processInUnitOfWork(batch, unitOfWork, segment);
  activeSegments.computeIfPresent(segment.getSegmentId(), (k, v) -> v.advancedTo(finalLastToken));
} catch (InterruptedException e) {
  logger.error(String.format("Event processor [%s] was interrupted. Shutting down.", getName()), e);
origin: org.axonframework/axon-messaging

/**
 * Indicates whether this segment can be merged with the given {@code other} segment.
 * <p>
 * Two segments can be merged when their mask is identical, and the only difference in SegmentID is in the first
 * 1-bit of their mask.
 *
 * @param other the Segment to verify mergeability for
 * @return {@code true} if the segments can be merged, otherwise {@code false}
 */
public boolean isMergeableWith(Segment other) {
  return this.mask == other.mask
      && mergeableSegmentId() == other.getSegmentId();
}
origin: org.axonframework/axon-core

/**
 * Indicates whether this segment can be merged with the given {@code other} segment.
 * <p>
 * Two segments can be merged when their mask is identical, and the only difference in SegmentID is in the first
 * 1-bit of their mask.
 *
 * @param other the Segment to verify mergeability for
 * @return {@code true} if the segments can be merged, otherwise {@code false}
 */
public boolean isMergeableWith(Segment other) {
  return this.mask == other.mask
      && mergeableSegmentId() == other.getSegmentId();
}
origin: org.axonframework/axon-core

@Override
public String toString() {
  return String.format("Segment[%d/%s]", getSegmentId(), getMask());
}
origin: org.axonframework/axon-messaging

@Override
public String toString() {
  return String.format("Segment[%d/%s]", getSegmentId(), getMask());
}
origin: org.axonframework/axon-core

private void checkSegmentCaughtUp(Segment segment, MessageStream<TrackedEventMessage<?>> eventStream) {
  if (!eventStream.hasNextAvailable()) {
    activeSegments.computeIfPresent(segment.getSegmentId(), (k, v) -> v.caughtUp());
  }
}
origin: org.axonframework/axon-messaging

private void checkSegmentCaughtUp(Segment segment, BlockingStream<TrackedEventMessage<?>> eventStream) {
  if (!eventStream.hasNextAvailable()) {
    activeSegments.computeIfPresent(segment.getSegmentId(), (k, v) -> v.caughtUp());
  }
}
origin: org.axonframework/axon-core

private void releaseToken(Segment segment) {
  try {
    transactionManager.executeInTransaction(() -> tokenStore.releaseClaim(getName(), segment.getSegmentId()));
  } catch (Exception e) {
    // whatever.
  }
}
origin: org.axonframework/axon-messaging

private void releaseToken(Segment segment) {
  try {
    transactionManager.executeInTransaction(() -> tokenStore.releaseClaim(getName(), segment.getSegmentId()));
  } catch (Exception e) {
    // Ignore exception
  }
}
origin: org.axonframework/axon-core

private MessageStream<TrackedEventMessage<?>> ensureEventStreamOpened(
    MessageStream<TrackedEventMessage<?>> eventStreamIn, Segment segment) {
  MessageStream<TrackedEventMessage<?>> eventStream = eventStreamIn;
  if (eventStream == null && state.get().isRunning()) {
    final TrackingToken trackingToken = transactionManager.fetchInTransaction(() -> tokenStore.fetchToken(getName(), segment.getSegmentId()));
    logger.info("Fetched token: {} for segment: {}", trackingToken, segment);
    eventStream = transactionManager.fetchInTransaction(
        () -> doOpenStream(trackingToken));
  }
  return eventStream;
}
origin: org.axonframework/axon-messaging

private BlockingStream<TrackedEventMessage<?>> ensureEventStreamOpened(
    BlockingStream<TrackedEventMessage<?>> eventStreamIn, Segment segment) {
  BlockingStream<TrackedEventMessage<?>> eventStream = eventStreamIn;
  if (eventStream == null && state.get().isRunning()) {
    final TrackingToken trackingToken = transactionManager.fetchInTransaction(
        () -> tokenStore.fetchToken(getName(), segment.getSegmentId())
    );
    logger.info("Fetched token: {} for segment: {}", trackingToken, segment);
    eventStream = transactionManager.fetchInTransaction(
        () -> doOpenStream(trackingToken));
  }
  return eventStream;
}
org.axonframework.eventhandlingSegmentgetSegmentId

Javadoc

Getter for the segment identifier.

Popular methods of Segment

  • getMask
    Getter for the segment mask.
  • matches
    Indicates whether the given value matches this segment. A value matches when the hashCode of a value
  • <init>
  • computeSegments
    Compute the Segment's from a given list of segmentId's.
  • isMergeableWith
    Indicates whether this segment can be merged with the given other segment. Two segments can be merge
  • mergeableSegmentId
    Returns the #getSegmentId() of the segment this one can be merged with
  • split
    Returns an array with two Segment. The first entry contains the original segmentId, with the newly

Popular in Java

  • Updating database using SQL prepared statement
  • addToBackStack (FragmentTransaction)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • setContentView (Activity)
  • KeyStore (java.security)
    This class represents an in-memory collection of keys and certificates. It manages two types of entr
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • BitSet (java.util)
    This class implements a vector of bits that grows as needed. Each component of the bit set has a boo
  • Pattern (java.util.regex)
    A compiled representation of a regular expression. A regular expression, specified as a string, must
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now