-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path08-data-transformations.cfc
38 lines (33 loc) · 1.23 KB
/
08-data-transformations.cfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
component extends="../BaseTask" {
function run() {
print.line().boldWhiteOnYellowLine( "Press Ctrl-C to exit" ).line();
print.blueLine( "Starting from: #getThreadname()#" ).toConsole();
var future = asyncManager.newFuture( () => compute( 2 ) )
// Use then like a map() operation and work on the results
.then( (data) => {
print.greenLine( "Computing from: #getThreadname()#" ).toConsole();
print.line( "incoming: #data#" ).toConsole();
print.line( "outgoing: #data * 2#" ).line().toConsole();
return data * 2;
} )
.then( (data) => {
print.greenLine( "Computing from: #getThreadname()#" ).toConsole();
print.line( "incoming: #data#" ).toConsole();
print.line( "outgoing: #data + 1#" ).line().toConsole();
return data + 1;
} )
.then( (data) => {
print.greenLine( "Computing from: #getThreadname()#" ).toConsole();
print.boldGreenLine( "Final Result: " & data ).toConsole();
} )
//.thenRun( (data) => print.boldGreenLine( "Final Result: " & data ) )
//print.blueLine( "Future Result: #future.get()#" )
// Why did it blow up? Ahh remember the return statemetns
while ( true ) {
if ( !isNull( checkInterrupted() ) ) {
return;
}
sleep( 100 );
}
}
}