Skip to content

AMCD(Asynchronous Multiple Condtions Dependence) 模式的java版本实现

License

Notifications You must be signed in to change notification settings

kaiyangjia/AMCD-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AMCD-java

AMCD(Asynchronous Multiple Condtions Dependence) 模式的java版本实现

TODO list

  1. add Callable exec.(that mean now the method setTarget for Callable is not work now) java public void setTarget(final Callable<A> target)

Demo

//in class Main
//init the repo Demo, and add some conditions
ConditionRepoManager manager = ConditionRepoManager.getInstance();
manager.obtain("Demo");
manager.add("condition1", "condition2", "condition3");

Runnable runnable = new Runnable{
    public void run(){
        //do what you want
    };
}
manager.setTarget();
//in class B
ConditionRepoManager manager = ConditionRepoManager.getInstance();
if (manager.complete("condition1")) {
    manager.getRepo("Demo").execTarget(new ExecCallback{
        public void onComplete(){
            //you already done what you want to do
        };

        public void onError(){

        };

        public void onResult(A result){

        };
    });
}
//in class C
ConditionRepoManager manager = ConditionRepoManager.getInstance();
if (manager.complete("condition1")) {
    manager.getRepo("Demo").execTarget(new ExecCallback{
        public void onComplete(){
            //you already done what you want to do
        };

        public void onError(){

        };

        public void onResult(A result){

        };
    });
}
//in class C
ConditionRepoManager manager = ConditionRepoManager.getInstance();
if (manager.complete("condition1")) {
    manager.getRepo("Demo").execTarget(new ExecCallback{
        public void onComplete(){
            //you already done what you want to do
        };

        public void onError(){

        };

        public void onResult(A result){

        };
    });
}
//in class N ...

OK ,that's all.I know it is easy.So , Good Luck!

About

AMCD(Asynchronous Multiple Condtions Dependence) 模式的java版本实现

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages