Comments (8)
@VaughnVernon Checked the test and it still fails and completes.hasFailed()
is false
As I'm changing in .NET implementation how continuations are executed, I have exactly the same problem now. From what I see as .andThen(new Integer(-100), (value) -> 2 * value)
is scheduled for execution immediately when we call completes.With(-100);
it doesn't matter anymore, because the continuation was already run.
I'm lost what should be the correct behavior.
from xoom-common.
@VaughnVernon Checked the test and it still fails and
completes.hasFailed()
isfalse
As I'm changing in .NET implementation how continuations are executed, I have exactly the same problem now. From what I see as
.andThen(new Integer(-100), (value) -> 2 * value)
is scheduled for execution immediately when we callcompletes.With(-100);
it doesn't matter anymore, because the continuation was already run.I'm lost what should be the correct behavior.
Seems like it's not that. Everything starts to execute only when with(-100)
is called. So it seems that it's not fixed yet
from xoom-common.
@tjaskula The execution must not start until with(outcome)
. The test is clean on local and Travis. There were bugs in your test so I had to change it. See the fixed test in BasicCompletesTest
.
from xoom-common.
@VaughnVernon Ok, this is the new test
@Test
public void testThatNonNullFailureOutcomeFails() {
final Completes<Integer> completes = new BasicCompletes<>(new Scheduler());
completes
.andThen(new Integer(-100), (value) -> 2 * value)
.andThen((x) -> andThenValue = x)
.otherwise((x) -> failureValue = 1000);
completes.with(-100);
final Integer completed = completes.await();
assertTrue(completes.hasFailed());
assertEquals(new Integer(1000), completed);
assertEquals(null, andThenValue);
assertEquals(new Integer(1000), failureValue);
}
My question is why assertEquals(new Integer(1000), completed);
? I thought that in that case the execution of 2 * value
should not have happened and the 1000
not computed ?
It means that even if the failedOutcomeValue == passed in value
it executes the current continuation but not the next one and if fails back to otherwise
?
from xoom-common.
@tjaskula The otherwise is executed because of the failure valve and it sets 1000.
from xoom-common.
Ok, so it executes the function and tries to execute the Otherwise branch with failedOutcome
from xoom-common.
Yes. It should be that any outcome in the pipeline that produces the failure value should execute the otherwise function. This includes before the first andThen.
from xoom-common.
Ok but the failure value must equal the outcome of previous execution or passed in value
from xoom-common.
Related Issues (11)
- BasicCompletes Must Handle Latent Registration of recoverFrom(Exception) HOT 2
- Completes.recoverFrom() should support a handler that returns a Completes<Y> not just Y
- Support for composition of Completes
- Support Completes<T> and CompletableFuture<T> In One Pipeline
- Redesign Completes<T> so it decouples composition and execution time HOT 5
- moved to trello
- Set up publishing snapshot builds to bintray HOT 1
- DynaFile is coupled to Maven. HOT 11
- please update vlingo-common in repository HOT 2
- Completes with map and flatmap HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xoom-common.