Class RequestContext

java.lang.Object
org.palladiosimulator.probeframework.measurement.RequestContext

public class RequestContext extends Object
This class represents the execution context of a request. Normally the execution context of a request is the thread which processes this request. Then the thread's id is a unique identifier for this execution context.

A RequestContext simply wraps an identifier that represents the execution context clearly. The thread id is such an identifier.

In order to represent a sequence of requests so that request1 spawned request2, which in turn spawned request3 and so forth, a parent context can be specified by using constructor RequestContext(String, RequestContext). In this way the execution of forks can be represented.

  • Field Details

    • EMPTY_REQUEST_CONTEXT

      public static final RequestContext EMPTY_REQUEST_CONTEXT
      Empty request context.
  • Constructor Details

    • RequestContext

      public RequestContext(String requestContextId, RequestContext parentContext)
      Default constructor. Used when there is a parent context.
      Parameters:
      requestContextId - The unique identifier of the request context.
      parentContext - The parent context of the context which is to be constructed.
    • RequestContext

      public RequestContext(String requestContextId)
      Convenience Constructor. Used when there is no parent context.
      Parameters:
      requestContextId - the unique identifier of the request context
  • Method Details

    • getRequestContextId

      public String getRequestContextId()
      Returns the unique identifier of the request context represented by this object.
      Returns:
      the request context identifier
    • getParentContext

      public RequestContext getParentContext()
      Getter for the parent context.
      Returns:
      The parent context.
    • getChildContexts

      public List<RequestContext> getChildContexts()
      Getter for the list of child contexts.
      Returns:
      The list of child contexts.
    • append

      public RequestContext append(String addition)
      Appends the specified addition to the request context id and returns a new RequestContext containing the extended request context id. The parent context will be retained.
      Parameters:
      addition - The String to append.
      Returns:
      The modified request context.
    • rootContext

      public RequestContext rootContext()
      Returns the root of the request context hierarchy (i.e., the top-most parent).
      Returns:
      The root request context.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object