Class NoOpToken

  • All Implemented Interfaces:
    Token, com.newrelic.api.agent.Token

    public class NoOpToken
    extends java.lang.Object
    implements Token
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static Token INSTANCE  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean expire()
      Once a token is taken from a transaction, the transaction will remain open until the token is expired.
      com.newrelic.api.agent.Transaction getTransaction()
      Returns the transaction associated with the token.
      boolean isActive()
      Returns true if the token can be used to link work.
      boolean link()
      Links the transaction associated with the token to the current thread.
      boolean linkAndExpire()
      Links the transaction associated with the token to the current thread and expires the token.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • INSTANCE

        public static final Token INSTANCE
    • Method Detail

      • expire

        public boolean expire()
        Description copied from interface: Token
        Once a token is taken from a transaction, the transaction will remain open until the token is expired. This means a token can be used to join multiple units of work together.
        Specified by:
        expire in interface Token
        Specified by:
        expire in interface com.newrelic.api.agent.Token
        Returns:
        True if the token was found and expired.
      • link

        public boolean link()
        Description copied from interface: Token
        Links the transaction associated with the token to the current thread. Linking does not start tracing work on the thread. @Trace must be called to begin tracing work to be put into the transaction.
        Specified by:
        link in interface Token
        Specified by:
        link in interface com.newrelic.api.agent.Token
        Returns:
        Returns true if the current thread has been linked to the token's transaction.
      • linkAndExpire

        public boolean linkAndExpire()
        Description copied from interface: Token
        Links the transaction associated with the token to the current thread and expires the token. If linking fails for any reason the token will still be expired. Linking does not start tracing work on the thread. @Trace must be called to begin tracing work to be put into the transaction.
        Specified by:
        linkAndExpire in interface Token
        Specified by:
        linkAndExpire in interface com.newrelic.api.agent.Token
        Returns:
        Returns true if the current thread has been linked to the token's transaction and the token has been expired, false otherwise. Note: The token will be expired (if found) even if the result of this call is "false".
      • isActive

        public boolean isActive()
        Description copied from interface: Token
        Returns true if the token can be used to link work. Returns false if the token has already been expired meaning it can no longer be used to link work.
        Specified by:
        isActive in interface Token
        Specified by:
        isActive in interface com.newrelic.api.agent.Token
        Returns:
        True if the token is active and can be used, false if the token has been expired.
      • getTransaction

        public com.newrelic.api.agent.Transaction getTransaction()
        Description copied from interface: Token
        Returns the transaction associated with the token.
        Specified by:
        getTransaction in interface Token
        Returns:
        Returns the transaction associated with the token or null if there is not one.