diff --git a/AbstractExecutorService.cfc b/AbstractExecutorService.cfc index 3e6f95e..de21086 100755 --- a/AbstractExecutorService.cfc +++ b/AbstractExecutorService.cfc @@ -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 @@ -176,4 +176,4 @@ component output="false" accessors="true"{ return this; } -} \ No newline at end of file +} diff --git a/Application.cfc b/Application.cfc index a0971f8..2b814fc 100755 --- a/Application.cfc +++ b/Application.cfc @@ -9,12 +9,10 @@ component{ function onRequestStart(){ if( structKeyExists(url, "reinit") ){ applicationStop(); - onApplicationStop(); - } } - function onApplicationStop(){ + function onApplicationEnd(required struct applicationScope){ } - -} \ No newline at end of file + +} diff --git a/examples/CancellingTasks/Application.cfc b/examples/CancellingTasks/Application.cfc index 5e78764..3b44c18 100755 --- a/examples/CancellingTasks/Application.cfc +++ b/examples/CancellingTasks/Application.cfc @@ -13,7 +13,6 @@ component extends="cfconcurrent.Application"{ function onRequestStart(){ if( structKeyExists(url, "stop") OR structKeyExists(url, "reinit") ){ applicationStop(); - onApplicationStop(); } if( structKeyExists(url, "reinit") ){ @@ -21,8 +20,10 @@ component extends="cfconcurrent.Application"{ } } - function onApplicationStop(){ - application.executorService.stop(); + function onApplicationEnd(required struct applicationScope){ + if (structKeyExists(arguments.applicationScope, "executorService")) { + arguments.applicationScope.executorService.stop(); + } } } \ No newline at end of file diff --git a/examples/CancellingTasks/index.cfm b/examples/CancellingTasks/index.cfm index 9ccaff1..d8bcc77 100755 --- a/examples/CancellingTasks/index.cfm +++ b/examples/CancellingTasks/index.cfm @@ -64,7 +64,7 @@

Stop or Re-init the app

Stop the app

Reinit the app

-

Note: Application.cfc will shut down the executor onApplicationStop()... Read that code. You must do this in your own code!

+

Note: Application.cfc will shut down the executor onApplicationEnd()... Read that code. You must do this in your own code!

diff --git a/examples/CancellingTasks/submit.cfm b/examples/CancellingTasks/submit.cfm index 9c61464..2e702d9 100755 --- a/examples/CancellingTasks/submit.cfm +++ b/examples/CancellingTasks/submit.cfm @@ -57,7 +57,7 @@ try{

Stop or Re-init the app

Stop the app

Reinit the app

-

Note: Application.cfc will shut down the executor onApplicationStop()... Read that code. You must do this in your own code!

+

Note: Application.cfc will shut down the executor onApplicationEnd()... Read that code. You must do this in your own code!

diff --git a/examples/ExecutorCompletionService/Application.cfc b/examples/ExecutorCompletionService/Application.cfc index a8d0b32..c6a083f 100755 --- a/examples/ExecutorCompletionService/Application.cfc +++ b/examples/ExecutorCompletionService/Application.cfc @@ -20,7 +20,6 @@ component extends="cfconcurrent.Application"{ function onRequestStart(){ if( structKeyExists(url, "stop") OR structKeyExists(url, "reinit") ){ applicationStop(); - onApplicationStop(); } if( structKeyExists(url, "reinit") ){ @@ -28,9 +27,11 @@ component extends="cfconcurrent.Application"{ } } - 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); + } } } \ No newline at end of file diff --git a/examples/ExecutorCompletionService/index.cfm b/examples/ExecutorCompletionService/index.cfm index 364f26c..2ef15bc 100755 --- a/examples/ExecutorCompletionService/index.cfm +++ b/examples/ExecutorCompletionService/index.cfm @@ -49,7 +49,7 @@

Stop or Re-init the app

Stop the app

Reinit the app

-

Note: Application.cfc will shut down the executor onApplicationStop()... Read that code. You must do this in your own code!

+

Note: Application.cfc will shut down the executor onApplicationEnd()... Read that code. You must do this in your own code!

diff --git a/examples/ExecutorCompletionService/submit.cfm b/examples/ExecutorCompletionService/submit.cfm index 3ce624f..a86235a 100755 --- a/examples/ExecutorCompletionService/submit.cfm +++ b/examples/ExecutorCompletionService/submit.cfm @@ -53,7 +53,7 @@

Stop or Re-init the app

Stop the app

Reinit the app

-

Note: Application.cfc will shut down the executor (and start a new one) onApplicationStop()... Read that code. You must do this in your own code!

+

Note: Application.cfc will shut down the executor (and start a new one) onApplicationEnd()... Read that code. You must do this in your own code!

diff --git a/examples/ExecutorService/Application.cfc b/examples/ExecutorService/Application.cfc index 1955152..3387e68 100755 --- a/examples/ExecutorService/Application.cfc +++ b/examples/ExecutorService/Application.cfc @@ -13,7 +13,6 @@ component extends="cfconcurrent.Application"{ function onRequestStart(){ if( structKeyExists(url, "stop") OR structKeyExists(url, "reinit") ){ applicationStop(); - onApplicationStop(); } if( structKeyExists(url, "reinit") ){ @@ -21,8 +20,10 @@ component extends="cfconcurrent.Application"{ } } - function onApplicationStop(){ - application.executorService.stop(); + function onApplicationEnd(required struct applicationScope){ + if (structKeyExists(arguments.applicationScope, "executorService")) { + arguments.applicationScope.executorService.stop(); + } } } \ No newline at end of file diff --git a/examples/ExecutorService/index.cfm b/examples/ExecutorService/index.cfm index 9ccaff1..d8bcc77 100755 --- a/examples/ExecutorService/index.cfm +++ b/examples/ExecutorService/index.cfm @@ -64,7 +64,7 @@

Stop or Re-init the app

Stop the app

Reinit the app

-

Note: Application.cfc will shut down the executor onApplicationStop()... Read that code. You must do this in your own code!

+

Note: Application.cfc will shut down the executor onApplicationEnd()... Read that code. You must do this in your own code!

diff --git a/examples/ExecutorService/submit.cfm b/examples/ExecutorService/submit.cfm index c87b6fa..bdf6dd4 100755 --- a/examples/ExecutorService/submit.cfm +++ b/examples/ExecutorService/submit.cfm @@ -103,7 +103,7 @@ for( future in futures ){

Stop or Re-init the app

Stop the app

Reinit the app

-

Note: Application.cfc will shut down the executor onApplicationStop()... Read that code. You must do this in your own code!

+

Note: Application.cfc will shut down the executor onApplicationEnd()... Read that code. You must do this in your own code!

diff --git a/examples/ScheduledThreadPoolExecutor/Application.cfc b/examples/ScheduledThreadPoolExecutor/Application.cfc index 597ea59..3a201d1 100755 --- a/examples/ScheduledThreadPoolExecutor/Application.cfc +++ b/examples/ScheduledThreadPoolExecutor/Application.cfc @@ -17,7 +17,6 @@ component extends="cfconcurrent.Application"{ function onRequestStart(){ if( structKeyExists(url, "stop") OR structKeyExists(url, "reinit") ){ applicationStop(); - onApplicationStop(); } if( structKeyExists(url, "reinit") ){ @@ -25,8 +24,10 @@ component extends="cfconcurrent.Application"{ } } - function onApplicationStop(){ - application.executorService.stop(); + function onApplicationEnd(required struct applicationScope){ + if (structKeyExists(arguments.applicationScope, "executorService")) { + arguments.applicationScope.executorService.stop(); + } } } \ No newline at end of file diff --git a/examples/ScheduledThreadPoolExecutor/index.cfm b/examples/ScheduledThreadPoolExecutor/index.cfm index b66b059..acd867e 100755 --- a/examples/ScheduledThreadPoolExecutor/index.cfm +++ b/examples/ScheduledThreadPoolExecutor/index.cfm @@ -53,7 +53,7 @@

Stop or Re-init the app

Stop the app

Reinit the app

-

Note: Application.cfc will shut down the executor onApplicationStop()... Read that code. You must do this in your own code!

+

Note: Application.cfc will shut down the executor onApplicationEnd()... Read that code. You must do this in your own code!

diff --git a/examples/ormInExecutor/Application.cfc b/examples/ormInExecutor/Application.cfc index 28691eb..aa0230d 100755 --- a/examples/ormInExecutor/Application.cfc +++ b/examples/ormInExecutor/Application.cfc @@ -18,7 +18,6 @@ component extends="cfconcurrent.Application"{ function onRequestStart(){ if( structKeyExists(url, "stop") OR structKeyExists(url, "reinit") ){ applicationStop(); - onApplicationStop(); } if( structKeyExists(url, "reinit") ){ @@ -26,8 +25,10 @@ component extends="cfconcurrent.Application"{ } } - function onApplicationStop(){ - application.executorCompletionService.stop(); + function onApplicationEnd(required struct applicationScope){ + if (structKeyExists(arguments.applicationScope, "executorCompletionService")) { + arguments.applicationScope.executorCompletionService.stop(); + } } } \ No newline at end of file