protected void execute()

in core/src/main/java/com/alibaba/smart/framework/engine/configuration/impl/DefaultDelegationExecutor.java [79:113]


    protected void execute(ExecutionContext context, JavaDelegation delegation,ExceptionProcessor exceptionProcessor ,boolean present) {


        if(!present){
            delegation.execute(context);
        }else {
            Retryable annotation = delegation.getClass().getAnnotation(Retryable.class);
            long delay = annotation.delay();
            int maxAttempts = annotation.maxAttempts();

            int attemptCount = 0;
            for (;  attemptCount < maxAttempts; attemptCount++) {

                boolean success = false;
                try {
                    delegation.execute(context);
                    success = true;
                }catch (Exception e){
                    dealException(exceptionProcessor, e,context);
                    ThreadPoolUtil.sleepSilently(delay);
                }

                if(success){
                    break;
                }


            }

            if(attemptCount == maxAttempts -1){
                // means all retry failed
                // record log ,trigger alert, persist params if needed
            }
        }
    }