Annotation DoubleKill

  • All Implemented Interfaces:
    java.lang.annotation.Annotation

    @Retention(value = RetentionPolicy.RUNTIME)@Target(value = ElementType.METHOD) 
    public @interface DoubleKill
    
                        
    the default key of @DoubleKill is array of [method, uid, args].
     - if the args is not easy to equals, use expression() to pickup
     - if uid is useless, use principal() to ignore
     - if expression() is no problem, toggle checkNull() to skip
    
    Note: When executing async and using with AOP annotations such as @Cacheable,
    make sure that DK is executed first. Otherwise, the result of the async execution
    cannot be processed correctly. If you can not guarantee the first execution,
    do not use at the same time.
    
    Repeated interception within the JVM will throw a no-stack exception to stop the execution,
    the caller needs to `catch` their own.
    - DoubleKillException will `throw` except those in sync execution.
    
    
    Since:

    2021-03-09

    Author:

    trydofor

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract String value() static key, just make sure it is unique within the method.
      abstract String expression() // @el(root: pro.fessional.wings.slardar.concur.impl.DoubleKillAround.
      abstract boolean checkNull() check expression() result, failed if null or empty string or string null
      abstract boolean principal() Whether to use spring SecurityContextHolder.context.authentication.
      abstract boolean async() Whether to execute the method async, default sync.
      abstract int progress() The seconds of the execution message remain in the ProgressContext.
      • Methods inherited from class java.lang.annotation.Annotation

        annotationType, equals, hashCode, toString
      • Methods inherited from class java.lang.Object

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

    • Method Detail

      • value

         abstract String value()

        static key, just make sure it is unique within the method. higher priority than `expression` key

      • expression

        @Language(value = "SpEL") abstract String expression()

        // @el(root: pro.fessional.wings.slardar.concur.impl.DoubleKillAround.Root)

        Used in the same way as `key` of `@Cacheable`, empty by default, with all arguments. If a static-key exists, the expression is omitted. Beans can be obtained using `@beanName`.

        Spring Expression Language (SpEL) expression for computing the key dynamically

        • #root.method, #root.target for references to the method, target object respectively.
        • Shortcuts for the method name (#root.methodName) and target class (#root.targetClass) are also available.
        • Method arguments can be accessed by index. For instance the 1st argument can be accessed via #root.args[0], #p0 or #a0. Arguments can also be accessed by #name if that information is available.
        Returns:

        SpEL

      • checkNull

         abstract boolean checkNull()

        check expression() result, failed if null or empty string or string null

      • principal

         abstract boolean principal()

        Whether to use spring SecurityContextHolder.context.authentication.principal in keys

      • async

         abstract boolean async()

        Whether to execute the method async, default sync. If async, the execution progresses with the ReturnOrException. Use spring @Async thread pool by default.

      • progress

         abstract int progress()

        The seconds of the execution message remain in the ProgressContext. default 300s