Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AbstractExecutorService.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ component output="false" accessors="true"{
/*
storage scope is a server-scoped bucket into which we put "things that can shut down";
we need this as a safeguard against developers who don't heed instructions to *ensure* that
stop() is called onApplicationStop().
stop() is called in onApplicationEnd().

Any executors we create will live in this scope, and on initialization, any previously created
executors will be shutdown immediately and then removed from scope
Expand Down Expand Up @@ -176,4 +176,4 @@ component output="false" accessors="true"{

return this;
}
}
}
8 changes: 3 additions & 5 deletions Application.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ component{
function onRequestStart(){
if( structKeyExists(url, "reinit") ){
applicationStop();
onApplicationStop();

}
}

function onApplicationStop(){
function onApplicationEnd(required struct applicationScope){
}

}
}
7 changes: 4 additions & 3 deletions examples/CancellingTasks/Application.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ component extends="cfconcurrent.Application"{
function onRequestStart(){
if( structKeyExists(url, "stop") OR structKeyExists(url, "reinit") ){
applicationStop();
onApplicationStop();
}

if( structKeyExists(url, "reinit") ){
location( "index.cfm", false );
}
}

function onApplicationStop(){
application.executorService.stop();
function onApplicationEnd(required struct applicationScope){
if (structKeyExists(arguments.applicationScope, "executorService")) {
arguments.applicationScope.executorService.stop();
}
}

}
2 changes: 1 addition & 1 deletion examples/CancellingTasks/index.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<h2>Stop or Re-init the app</h2>
<p><a href="index.cfm?stop">Stop the app</a></p>
<p><a href="index.cfm?reinit">Reinit the app</a></p>
<p><b>Note: </b> Application.cfc will shut down the executor onApplicationStop()... Read that code. You <b>must</b> do this in your own code!</p>
<p><b>Note: </b> Application.cfc will shut down the executor onApplicationEnd()... Read that code. You <b>must</b> do this in your own code!</p>
</div><!--/span-->

</div><!--/row-->
Expand Down
2 changes: 1 addition & 1 deletion examples/CancellingTasks/submit.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ try{
<h2>Stop or Re-init the app</h2>
<p><a href="index.cfm?stop">Stop the app</a></p>
<p><a href="index.cfm?reinit">Reinit the app</a></p>
<p><b>Note: </b> Application.cfc will shut down the executor onApplicationStop()... Read that code. You <b>must</b> do this in your own code!</p>
<p><b>Note: </b> Application.cfc will shut down the executor onApplicationEnd()... Read that code. You <b>must</b> do this in your own code!</p>
</div><!--/span-->

</div><!--/row-->
Expand Down
9 changes: 5 additions & 4 deletions examples/ExecutorCompletionService/Application.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,18 @@ component extends="cfconcurrent.Application"{
function onRequestStart(){
if( structKeyExists(url, "stop") OR structKeyExists(url, "reinit") ){
applicationStop();
onApplicationStop();
}

if( structKeyExists(url, "reinit") ){
location( "index.cfm", false );
}
}

function onApplicationStop(){
writeLog("Stopping #application.applicationName# Completion Service");
application.executorCompletionService.stop(timeout=5000);
function onApplicationEnd(required struct applicationScope){
if (structKeyExists(arguments.applicationScope, "executorCompletionService")) {
writeLog("Stopping #application.applicationName# Completion Service");
arguments.applicationScope.executorCompletionService.stop(timeout=5000);
}
}

}
2 changes: 1 addition & 1 deletion examples/ExecutorCompletionService/index.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<h2>Stop or Re-init the app</h2>
<p><a href="index.cfm?stop">Stop the app</a></p>
<p><a href="index.cfm?reinit">Reinit the app</a></p>
<p><b>Note: </b> Application.cfc will shut down the executor onApplicationStop()... Read that code. You <b>must</b> do this in your own code!</p>
<p><b>Note: </b> Application.cfc will shut down the executor onApplicationEnd()... Read that code. You <b>must</b> do this in your own code!</p>
</div><!--/span-->

</div><!--/row-->
Expand Down
2 changes: 1 addition & 1 deletion examples/ExecutorCompletionService/submit.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<h2>Stop or Re-init the app</h2>
<p><a href="index.cfm?stop">Stop the app</a></p>
<p><a href="index.cfm?reinit">Reinit the app</a></p>
<p><b>Note: </b> Application.cfc will shut down the executor (and start a new one) onApplicationStop()... Read that code. You <b>must</b> do this in your own code!</p>
<p><b>Note: </b> Application.cfc will shut down the executor (and start a new one) onApplicationEnd()... Read that code. You <b>must</b> do this in your own code!</p>
</div><!--/span-->

</div><!--/row-->
Expand Down
7 changes: 4 additions & 3 deletions examples/ExecutorService/Application.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ component extends="cfconcurrent.Application"{
function onRequestStart(){
if( structKeyExists(url, "stop") OR structKeyExists(url, "reinit") ){
applicationStop();
onApplicationStop();
}

if( structKeyExists(url, "reinit") ){
location( "index.cfm", false );
}
}

function onApplicationStop(){
application.executorService.stop();
function onApplicationEnd(required struct applicationScope){
if (structKeyExists(arguments.applicationScope, "executorService")) {
arguments.applicationScope.executorService.stop();
}
}

}
2 changes: 1 addition & 1 deletion examples/ExecutorService/index.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<h2>Stop or Re-init the app</h2>
<p><a href="index.cfm?stop">Stop the app</a></p>
<p><a href="index.cfm?reinit">Reinit the app</a></p>
<p><b>Note: </b> Application.cfc will shut down the executor onApplicationStop()... Read that code. You <b>must</b> do this in your own code!</p>
<p><b>Note: </b> Application.cfc will shut down the executor onApplicationEnd()... Read that code. You <b>must</b> do this in your own code!</p>
</div><!--/span-->

</div><!--/row-->
Expand Down
2 changes: 1 addition & 1 deletion examples/ExecutorService/submit.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ for( future in futures ){
<h2>Stop or Re-init the app</h2>
<p><a href="index.cfm?stop">Stop the app</a></p>
<p><a href="index.cfm?reinit">Reinit the app</a></p>
<p><b>Note: </b> Application.cfc will shut down the executor onApplicationStop()... Read that code. You <b>must</b> do this in your own code!</p>
<p><b>Note: </b> Application.cfc will shut down the executor onApplicationEnd()... Read that code. You <b>must</b> do this in your own code!</p>
</div><!--/span-->

</div><!--/row-->
Expand Down
7 changes: 4 additions & 3 deletions examples/ScheduledThreadPoolExecutor/Application.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@ component extends="cfconcurrent.Application"{
function onRequestStart(){
if( structKeyExists(url, "stop") OR structKeyExists(url, "reinit") ){
applicationStop();
onApplicationStop();
}

if( structKeyExists(url, "reinit") ){
location( "index.cfm", false );
}
}

function onApplicationStop(){
application.executorService.stop();
function onApplicationEnd(required struct applicationScope){
if (structKeyExists(arguments.applicationScope, "executorService")) {
arguments.applicationScope.executorService.stop();
}
}

}
2 changes: 1 addition & 1 deletion examples/ScheduledThreadPoolExecutor/index.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<h2>Stop or Re-init the app</h2>
<p><a href="index.cfm?stop">Stop the app</a></p>
<p><a href="index.cfm?reinit">Reinit the app</a></p>
<p><b>Note: </b> Application.cfc will shut down the executor onApplicationStop()... Read that code. You <b>must</b> do this in your own code!</p>
<p><b>Note: </b> Application.cfc will shut down the executor onApplicationEnd()... Read that code. You <b>must</b> do this in your own code!</p>
</div><!--/span-->

</div><!--/row-->
Expand Down
7 changes: 4 additions & 3 deletions examples/ormInExecutor/Application.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@ component extends="cfconcurrent.Application"{
function onRequestStart(){
if( structKeyExists(url, "stop") OR structKeyExists(url, "reinit") ){
applicationStop();
onApplicationStop();
}

if( structKeyExists(url, "reinit") ){
location( "index.cfm", false );
}
}

function onApplicationStop(){
application.executorCompletionService.stop();
function onApplicationEnd(required struct applicationScope){
if (structKeyExists(arguments.applicationScope, "executorCompletionService")) {
arguments.applicationScope.executorCompletionService.stop();
}
}

}