Created
September 6, 2012 18:36
-
-
Save ubiquitousthey/3659297 to your computer and use it in GitHub Desktop.
Deferred Usage with node
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Usage | |
DeferredPromise<MedicalRecord> mrDef = mgr.get(MedicalRecord.class, mrid); | |
DeferredPromise<Problem> pDef = mgr.get(Problem.class, pid); | |
// Implicit Error Handling (Red Bar) | |
Deferred.when(mrDef, pDef).then(new EmrDeferredCommand(){ | |
@Override public void doOnSuccess(){ | |
MedicalRecord mr = mrDef.getResult(); | |
Problem p = pDef.getResult(); | |
// yadda yadda yadda | |
} | |
}) | |
// Explicit Error Handling (Do we ever do this?) | |
Deferred.when(mrDef, pDef).then(new DeferredCommand(){ | |
@Override public void doOnSuccess(){ | |
MedicalRecord mr = mrDef.getResult(); | |
Problem p = pDef.getResult(); | |
// yadda yadda yadda | |
} | |
@Override public void doOnFailure(List<Throwable> exceptions){ | |
//Log stuff | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment