Class DiagnosticHigsonEngine

java.lang.Object
io.higson.runtime.core.HigsonEngineImpl
io.higson.runtime.core.DiagnosticHigsonEngine
All Implemented Interfaces:
HigsonEngine

public class DiagnosticHigsonEngine extends HigsonEngineImpl
Diagnostic (profiling) variant of HigsonEngineImpl.

Records a call-stack trace into a thread-local DiagnosticCallStack for every get, call and flow invocation. The class is selected by HigsonEngineFactory when profilerEnabled = true; when profiling is off the plain HigsonEngineImpl is used — zero overhead, no if in the hot path.

Top-level detection: before the first push the stack is empty (isEmpty() == true). In the finally block of a top-level call the collected events are aggregated into a summary and handed to the DiagnosticCallStackFlushStrategy. The strategy decides whether to dispatch the report to the diagnostic queue (production) or preserve the stack for later inspection (tester).

  • Constructor Details

  • Method Details

    • get

      public ParamValue get(String parameterName, ParamContext ctx)
      Description copied from interface: HigsonEngine
      This method tries to fetch parameter's value for given parameterName and context ctx. If parameter requires context for proper working(context is defined parameter's metadata), then it must be provided, so values could be fetched for matched context.

      Example:

      
       HigsonEngine engine = .. // might be injected or created from HigsonEngineFactory
       ParamValue paramValue = engine.get("parameter.code", new HigsonContext());
       
      Specified by:
      get in interface HigsonEngine
      Overrides:
      get in class HigsonEngineImpl
      Parameters:
      parameterName - parameter name
      ctx - context that is required for proper parameter fetching
      Returns:
      parameter value if found, or might be null
      See Also:
    • call

      public Object call(String functionName, ParamContext ctx, Object... args)
      Description copied from interface: HigsonEngine
      This method calls function defined within higson, with context and optional arguments. Function might return value as Object.

      Example:

      
       HigsonEngine engine = .. // might be injected or created from HigsonEngineFactory
       Object result = engine.call("function.name", new HigsonContext(), 1, 2, 3);
       
      Specified by:
      call in interface HigsonEngine
      Overrides:
      call in class HigsonEngineImpl
      Parameters:
      functionName - function name
      ctx - context used by function
      args - optional argument, if function requires them
      Returns:
      possible result of function call
      See Also:
    • flow

      public FlowResult flow(String flowName, ParamContext ctx, Object... args)
      Description copied from interface: HigsonEngine
      This method calls flow defined within higson, with context and optional arguments. Flow might return value as FlowResult.

      Example:

      
       HigsonEngine engine = .. // might be injected or created from HigsonEngineFactory
       Object result = engine.flow("flow.name", new HigsonContext(), 1, 2, 3);
       
      Specified by:
      flow in interface HigsonEngine
      Overrides:
      flow in class HigsonEngineImpl
      Parameters:
      flowName - flow name
      ctx - context used by function
      args - optional argument, if function requires them
      Returns:
      FlowResult containing map with flow output and trace
      See Also:
    • getDomain

      public DomainObject getDomain(String profile, String objectPath)
      Description copied from interface: HigsonEngine
      Get domain object based on given profile and objectPath. It will be either head object or from user's session.
      How objectPath is defined: "/PLANS[LIAB]/OPTIONS[OPT1]" - where
      • /PLANS[LIAB] - LIAB code element within PLANS collection
      • / - acts as separator between child and parent
      • /OPTIONS[OPT1] - OPT1 code element within OPTIONS collection, that is child of PLANS[LIAB]

      Example:

      
        HigsonEngine engine = .. // might be injected or created from HigsonEngineFactory
        HigsonDomainObject root = engine.getDomain("PROFILE1", "/");   // root domain object for PROFILE1
        HigsonDomainObject adminElement = engine.getDomain("PROFILE1", "/USERS[ADMIN]");   // domain object with code "ADMIN" within collection "USERS"
       
      Specified by:
      getDomain in interface HigsonEngine
      Overrides:
      getDomain in class HigsonEngineImpl
      Parameters:
      profile - profile code
      objectPath - full path to domain object
      Returns:
      domain object if found, or null
      See Also: