All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.neko233.skilltree.aop.api.impl.retry.RetryAopApi Maven / Gradle / Ivy

There is a newer version: 0.3.6
Show newest version
package com.neko233.skilltree.aop.api.impl.retry;

import com.neko233.skilltree.aop.api.AopApi;

import java.io.IOException;
import java.lang.reflect.Method;

public class RetryAopApi implements AopApi {

    private final int retryCount;

    public RetryAopApi(int retryCount) {
        this.retryCount = retryCount;
    }

    @Override
    public void init() {

    }

    @Override
    public void finish() {

    }

    @Override
    public void preHandle(Method method,
                          Object target,
                          Object[] args) {
        // Do nothing
    }

    @Override
    public void postHandle(Method method,
                           Object target,
                           Object[] args) {
        // Do nothing
    }

    @Override
    public boolean tryEatException(Exception e) {
        if (e instanceof IOException) {
            return true;
        }
        return false;
    }

    @Override
    public int retryCountOnError() {
        return retryCount;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy