com.octo.captcha.engine.bufferedengine.manager
Class QuartzBufferedEngineManager

java.lang.Object
  extended by com.octo.captcha.engine.bufferedengine.manager.QuartzBufferedEngineManager
All Implemented Interfaces:
BufferedEngineContainerManager

public class QuartzBufferedEngineManager
extends java.lang.Object
implements BufferedEngineContainerManager

Manager of a Quartz Buffered Engine


Constructor Summary
QuartzBufferedEngineManager(QuartzBufferedEngineContainer container, org.quartz.Scheduler factory, CronTrigger cronFeeder, CronTrigger cronSwapper, JobDetail jobFeeder, JobDetail jobSwapper)
          Constructor of the manager
 
Method Summary
 void clearPersistentBuffer()
          Clear the persitent buffer
 void clearVolatileBuffer()
          Clear the volatile buffer
 java.lang.String getFeedCronExpr()
           
 int getFeedSize()
          Get number of captchas to feed the disk buffer
protected  java.util.Locale getLocaleFromName(java.lang.String localeName)
           
 HashedMap getLocaleRatio()
           
 int getMaxPersistentMemorySize()
          Get maximum size for the disk buffer
 int getMaxVolatileMemorySize()
          Get maximun size for the volatile buffer
 int getPersistentBufferSize()
           
 HashedMap getPersistentBufferSizesByLocales()
           
 int getPersistentFeedings()
           
 int getPersistentMemoryHits()
           
 int getPersistentToVolatileSwaps()
           
 java.lang.String getSwapCronExpr()
           
 int getSwapSize()
          Get number of captchas to swap between the volatil buffer and the disk buffer
 int getVolatileBufferSize()
           
 HashedMap getVolatileBufferSizeByLocales()
           
 int getVolatileMemoryHits()
           
 void pause()
          Pause the scheduler, both the swapping and the feeding process are paused
 void removeLocaleRatio(java.lang.String localeName)
           
 void resume()
          Resume the scheduler, both the swapping and the feeding process are resumed
 void setFeedCronExpr(java.lang.String feedCronExpr)
          Set the cron expression for feeding operations
 void setFeedSize(int feedSize)
           
 void setLocaleRatio(java.lang.String localeName, double ratio)
           
 void setMaxPersistentMemorySize(int maxPersistentMemorySize)
           
 void setMaxVolatileMemorySize(int maxVolatileMemorySize)
           
 void setSwapCronExpr(java.lang.String swapCronExpr)
          Set the cron expression for swapping operations
 void setSwapSize(int swapSize)
           
 void shutdown()
          Shutdown scheduling, the container will use its memory buffer until its empty and swtich to the engine.
 void startToFeedPersistantBuffer()
          Tell the scheduler to start to feed the persistent buffer
 void startToSwapFromPersistentToVolatileMemory()
          Tell the scheduler to start to swap captchas from persistent buffer to memory buffer
 void stopToFeedPersistentBuffer()
          Tell the scheduler to stop to feed the persistent buffer
 void stopToSwapFromPersistentToVolatileMemory()
          Tell the scheduler to stop to swap captchas from persistent buffer to memory buffer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuartzBufferedEngineManager

public QuartzBufferedEngineManager(QuartzBufferedEngineContainer container,
                                   org.quartz.Scheduler factory,
                                   CronTrigger cronFeeder,
                                   CronTrigger cronSwapper,
                                   JobDetail jobFeeder,
                                   JobDetail jobSwapper)
Constructor of the manager

Parameters:
container - The QuartzBufferedEngineContainer
factory - The scheduler Factory to manipulate Qua rtz
cronFeeder - The CronTrigger that feed the persistent memory
cronSwapper - The CronTrigger that swap between the persistent memory and the volatile memory
jobFeeder - Job detail of the feeding job
jobSwapper - Job detail of the swapping job
Method Detail

startToFeedPersistantBuffer

public void startToFeedPersistantBuffer()
Description copied from interface: BufferedEngineContainerManager
Tell the scheduler to start to feed the persistent buffer

Specified by:
startToFeedPersistantBuffer in interface BufferedEngineContainerManager
See Also:
BufferedEngineContainerManager.startToFeedPersistantBuffer()

stopToFeedPersistentBuffer

public void stopToFeedPersistentBuffer()
Description copied from interface: BufferedEngineContainerManager
Tell the scheduler to stop to feed the persistent buffer

Specified by:
stopToFeedPersistentBuffer in interface BufferedEngineContainerManager
See Also:
BufferedEngineContainerManager.stopToFeedPersistentBuffer()

startToSwapFromPersistentToVolatileMemory

public void startToSwapFromPersistentToVolatileMemory()
Description copied from interface: BufferedEngineContainerManager
Tell the scheduler to start to swap captchas from persistent buffer to memory buffer

Specified by:
startToSwapFromPersistentToVolatileMemory in interface BufferedEngineContainerManager
See Also:
BufferedEngineContainerManager.startToSwapFromPersistentToVolatileMemory()

stopToSwapFromPersistentToVolatileMemory

public void stopToSwapFromPersistentToVolatileMemory()
Description copied from interface: BufferedEngineContainerManager
Tell the scheduler to stop to swap captchas from persistent buffer to memory buffer

Specified by:
stopToSwapFromPersistentToVolatileMemory in interface BufferedEngineContainerManager
See Also:
BufferedEngineContainerManager.stopToSwapFromPersistentToVolatileMemory()

setFeedCronExpr

public void setFeedCronExpr(java.lang.String feedCronExpr)
Set the cron expression for feeding operations

Parameters:
feedCronExpr - the cron expression in a quartz way

setSwapCronExpr

public void setSwapCronExpr(java.lang.String swapCronExpr)
Set the cron expression for swapping operations

Parameters:
swapCronExpr - the cron expression in a quartz way

getFeedCronExpr

public java.lang.String getFeedCronExpr()
Returns:
the cron expresson for feeding operations

getSwapCronExpr

public java.lang.String getSwapCronExpr()
Returns:
the cron expresson for swapping operations

pause

public void pause()
Description copied from interface: BufferedEngineContainerManager
Pause the scheduler, both the swapping and the feeding process are paused

Specified by:
pause in interface BufferedEngineContainerManager
See Also:
BufferedEngineContainerManager.pause()

resume

public void resume()
Description copied from interface: BufferedEngineContainerManager
Resume the scheduler, both the swapping and the feeding process are resumed

Specified by:
resume in interface BufferedEngineContainerManager
See Also:
BufferedEngineContainerManager.resume()

shutdown

public void shutdown()
Description copied from interface: BufferedEngineContainerManager
Shutdown scheduling, the container will use its memory buffer until its empty and swtich to the engine.

Specified by:
shutdown in interface BufferedEngineContainerManager
See Also:
BufferedEngineContainerManager.shutdown()

getPersistentFeedings

public int getPersistentFeedings()
Specified by:
getPersistentFeedings in interface BufferedEngineContainerManager
Returns:
the number of disk feedings
See Also:
BufferedEngineContainerManager.getPersistentFeedings()

getPersistentMemoryHits

public int getPersistentMemoryHits()
Specified by:
getPersistentMemoryHits in interface BufferedEngineContainerManager
Returns:
the number of persistent accesses
See Also:
BufferedEngineContainerManager.getPersistentMemoryHits()

getPersistentToVolatileSwaps

public int getPersistentToVolatileSwaps()
Specified by:
getPersistentToVolatileSwaps in interface BufferedEngineContainerManager
Returns:
the number of swap from disk to memory
See Also:
BufferedEngineContainerManager.getPersistentToVolatileSwaps()

getVolatileMemoryHits

public int getVolatileMemoryHits()
Specified by:
getVolatileMemoryHits in interface BufferedEngineContainerManager
Returns:
the number of volatile memory access
See Also:
BufferedEngineContainerManager.getVolatileMemoryHits()

getFeedSize

public int getFeedSize()
Description copied from interface: BufferedEngineContainerManager
Get number of captchas to feed the disk buffer

Specified by:
getFeedSize in interface BufferedEngineContainerManager
See Also:
BufferedEngineContainerManager.getFeedSize()

setFeedSize

public void setFeedSize(int feedSize)
Specified by:
setFeedSize in interface BufferedEngineContainerManager
Parameters:
feedSize - Set number of captchas to produce at each iteration.
See Also:
BufferedEngineContainerManager.setFeedSize(int)

getLocaleRatio

public HashedMap getLocaleRatio()
See Also:
com.octo.captcha.engine.bufferedengine.manager.BufferedEngineContainerManager#getLocaleRatio

setLocaleRatio

public void setLocaleRatio(java.lang.String localeName,
                           double ratio)
Specified by:
setLocaleRatio in interface BufferedEngineContainerManager
Parameters:
localeName - Name of th locale to set or to create
ratio - The ratio of the locale
See Also:
BufferedEngineContainerManager.setLocaleRatio(java.lang.String, double)

getLocaleFromName

protected java.util.Locale getLocaleFromName(java.lang.String localeName)
See Also:
com.octo.captcha.engine.bufferedengine.manager.BufferedEngineContainerManager#getLocaleFromName

removeLocaleRatio

public void removeLocaleRatio(java.lang.String localeName)
See Also:
com.octo.captcha.engine.bufferedengine.manager.BufferedEngineContainerManager#removeLocaleRatio

getMaxPersistentMemorySize

public int getMaxPersistentMemorySize()
Description copied from interface: BufferedEngineContainerManager
Get maximum size for the disk buffer

Specified by:
getMaxPersistentMemorySize in interface BufferedEngineContainerManager
See Also:
BufferedEngineContainerManager.getMaxPersistentMemorySize()

setMaxPersistentMemorySize

public void setMaxPersistentMemorySize(int maxPersistentMemorySize)
Specified by:
setMaxPersistentMemorySize in interface BufferedEngineContainerManager
Parameters:
maxPersistentMemorySize - Set maximum size for the disk buffer
See Also:
BufferedEngineContainerManager.setMaxPersistentMemorySize(int)

getMaxVolatileMemorySize

public int getMaxVolatileMemorySize()
Description copied from interface: BufferedEngineContainerManager
Get maximun size for the volatile buffer

Specified by:
getMaxVolatileMemorySize in interface BufferedEngineContainerManager
See Also:
BufferedEngineContainerManager.getMaxVolatileMemorySize()

setMaxVolatileMemorySize

public void setMaxVolatileMemorySize(int maxVolatileMemorySize)
Specified by:
setMaxVolatileMemorySize in interface BufferedEngineContainerManager
Parameters:
maxVolatileMemorySize - Set maximun size for the volatile buffer
See Also:
BufferedEngineContainerManager.setMaxVolatileMemorySize(int)

getSwapSize

public int getSwapSize()
Description copied from interface: BufferedEngineContainerManager
Get number of captchas to swap between the volatil buffer and the disk buffer

Specified by:
getSwapSize in interface BufferedEngineContainerManager
See Also:
BufferedEngineContainerManager.getSwapSize()

setSwapSize

public void setSwapSize(int swapSize)
Specified by:
setSwapSize in interface BufferedEngineContainerManager
Parameters:
swapSize - Set number of captchas to swap between the volatil buffer and the disk buffer
See Also:
BufferedEngineContainerManager.setSwapSize(int)

getVolatileBufferSize

public int getVolatileBufferSize()
Specified by:
getVolatileBufferSize in interface BufferedEngineContainerManager
Returns:
the size of the volatile Buffer (RAM buffer)
See Also:
BufferedEngineContainerManager.getVolatileBufferSize()

getVolatileBufferSizeByLocales

public HashedMap getVolatileBufferSizeByLocales()
Specified by:
getVolatileBufferSizeByLocales in interface BufferedEngineContainerManager
Returns:
an hashedMap of sizes by locale
See Also:
BufferedEngineContainerManager.getVolatileBufferSizeByLocales()

getPersistentBufferSize

public int getPersistentBufferSize()
Specified by:
getPersistentBufferSize in interface BufferedEngineContainerManager
Returns:
the size of the persitent Buffer (disk buffer)
See Also:
BufferedEngineContainerManager.getPersistentBufferSize()

getPersistentBufferSizesByLocales

public HashedMap getPersistentBufferSizesByLocales()
Specified by:
getPersistentBufferSizesByLocales in interface BufferedEngineContainerManager
Returns:
an hashedMap of sizes by locale
See Also:
BufferedEngineContainerManager.getPersistentBufferSizesByLocales()

clearVolatileBuffer

public void clearVolatileBuffer()
Description copied from interface: BufferedEngineContainerManager
Clear the volatile buffer

Specified by:
clearVolatileBuffer in interface BufferedEngineContainerManager
See Also:
BufferedEngineContainerManager.clearVolatileBuffer()

clearPersistentBuffer

public void clearPersistentBuffer()
Description copied from interface: BufferedEngineContainerManager
Clear the persitent buffer

Specified by:
clearPersistentBuffer in interface BufferedEngineContainerManager
See Also:
BufferedEngineContainerManager.clearPersistentBuffer()


Copyright 2003-2009 JCaptcha. All Rights Reserved.