diff --git a/AbstractCompletionTask.cfc b/AbstractCompletionTask.cfc index 15f97a9..d00d3f4 100755 --- a/AbstractCompletionTask.cfc +++ b/AbstractCompletionTask.cfc @@ -15,7 +15,7 @@ component output="false" accessors="true"{ } public function process( array results ){ - writeLog("OVERRIDE ME!"); + logInfo("OVERRIDE ME!"); } @@ -52,7 +52,7 @@ component output="false" accessors="true"{ if( NOT arrayIsEmpty(allResults) ){ process( allResults ); } else if( getLoggingEnabled() ) { - writeLog("Results were empty..."); + logInfo("Results were empty..."); } } catch( Any e ) @@ -62,6 +62,10 @@ component output="false" accessors="true"{ } + function logInfo( message ){ + writeLog(arguments.message); + } + function logError( error, message ){ writeLog("#message# : #error.message#; #error.detail#"); lastError = error; diff --git a/AbstractExecutorService.cfc b/AbstractExecutorService.cfc index 3e6f95e..02320c3 100755 --- a/AbstractExecutorService.cfc +++ b/AbstractExecutorService.cfc @@ -44,18 +44,18 @@ component output="false" accessors="true"{ public function start(){ //This will be overridden by implementers - status = "started"; + variables.status = "started"; return this; } public function stop( timeout=100, timeUnit="#objectFactory.MILLISECONDS#" ){ shutdownAllExecutors( timeout, timeUnit ); - status = "stopped"; + variables.status = "stopped"; return this; } public function pause(){ - status = "paused"; + variables.status = "paused"; return this; } @@ -63,7 +63,7 @@ component output="false" accessors="true"{ if( isStopped() ){ start(); } else { - status = "started"; + variables.status = "started"; } return this; } diff --git a/ScheduledThreadPoolExecutor.cfc b/ScheduledThreadPoolExecutor.cfc index 2949fed..5069ed5 100755 --- a/ScheduledThreadPoolExecutor.cfc +++ b/ScheduledThreadPoolExecutor.cfc @@ -10,12 +10,12 @@ component extends="ExecutorService" accessors="true" output="false"{ super.init( serviceName, maxConcurrent, -1, objectFactory ); - storedTasks = {}; + variables.storedTasks = {}; return this; } public function start(){ - variables.scheduledExecutor = objectFactory.createScheduledThreadPoolExecutor( maxConcurrent ); + variables.scheduledExecutor = variables.objectFactory.createScheduledThreadPoolExecutor( maxConcurrent ); //store the executor for sane destructability storeExecutor( "scheduledExecutor", variables.scheduledExecutor ); @@ -25,8 +25,8 @@ component extends="ExecutorService" accessors="true" output="false"{ public function scheduleAtFixedRate( id, task, initialDelay, period, timeUnit="#objectFactory.SECONDS#" ){ cancelTask( id ); - var future = scheduledExecutor.scheduleAtFixedRate( - objectFactory.createRunnableProxy( task ), + var future = variables.scheduledExecutor.scheduleAtFixedRate( + variables.objectFactory.createRunnableProxy( task ), initialDelay, period, timeUnit @@ -37,8 +37,8 @@ component extends="ExecutorService" accessors="true" output="false"{ public function scheduleWithFixedDelay( id, task, initialDelay, delay, timeUnit="#objectFactory.SECONDS#" ){ cancelTask( id ); - var future = scheduledExecutor.scheduleWithFixedDelay( - objectFactory.createRunnableProxy( task ), + var future = variables.scheduledExecutor.scheduleWithFixedDelay( + variables.objectFactory.createRunnableProxy( task ), initialDelay, delay, timeUnit @@ -48,7 +48,7 @@ component extends="ExecutorService" accessors="true" output="false"{ } package function storeTask( id, task, future ){ - storedTasks[ id ] = { task = task, future = future }; + variables.storedTasks[ id ] = { task = task, future = future }; return this; } @@ -57,12 +57,12 @@ component extends="ExecutorService" accessors="true" output="false"{ The 'future' is the object returned when submitting the task */ public function cancelTask( id ){ - if( structKeyExists( storedTasks, id ) ){ - var task = storedTasks[ id ]; + if( structKeyExists( variables.storedTasks, id ) ){ + var task = variables.storedTasks[ id ]; var future = task.future; future.cancel( true ); - scheduledExecutor.purge(); - structDelete( storedTasks, id ); + variables.scheduledExecutor.purge(); + structDelete( variables.storedTasks, id ); return task; } }