Package com.avoka.fc.core.service.form
Class FormWorkerController
- java.lang.Object
-
- com.avoka.fc.core.service.form.FormWorkerController
-
- All Implemented Interfaces:
Serializable
public class FormWorkerController extends Object implements Serializable
Provides a Form Worker Controller class to protect access to constrained resources.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FormWorkerController.RenderMetric
Provides a rendering metric information class which parallels what is recorded in the request_log.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acquireSemaphore()
Acquire the form worker semaphore.int
getAndResetNoCapacityEvents()
Get and reset the number of no capacity events.static FormWorkerController
getFormWorkerController()
Return the web application form worker controller instance.static List<FormWorkerController>
getFormWorkerSemaphoreList()
Return the list of form worker semaphores for the JVM.int
getQueueLength()
Return the form worker semaphore queue depth.FormWorkerController.RenderMetric
getSumRenderMetricAndReset()
Return the average render metric for the last period and reset.int
getThreadCount()
Return the form worker current thread count (max threads - available permits).boolean
hasFormRenderCapacity()
Return true if semaphore queue is less or equal to than the max_form_worker_queue depth.void
registerNoCapacityEvent()
Manually register a no capacity event.void
registerRenderMetric(Integer renderTime, Integer loadTime, Integer totalTime)
Register the render time, load time and total time rendering metrics.void
releaseSemaphore()
Release the form worker semaphore.String
toString()
Return the string representation of this object.
-
-
-
Method Detail
-
getFormWorkerSemaphoreList
public static List<FormWorkerController> getFormWorkerSemaphoreList()
Return the list of form worker semaphores for the JVM.- Returns:
- the list of form worker semaphores for the JVM
-
getFormWorkerController
public static FormWorkerController getFormWorkerController()
Return the web application form worker controller instance.- Returns:
- the web application form worker controller instance
-
acquireSemaphore
public void acquireSemaphore() throws InterruptedException
Acquire the form worker semaphore.- Throws:
InterruptedException
- if an interrupt occured acquiring the semaphore
-
releaseSemaphore
public void releaseSemaphore()
Release the form worker semaphore.
-
hasFormRenderCapacity
public boolean hasFormRenderCapacity()
Return true if semaphore queue is less or equal to than the max_form_worker_queue depth.- Returns:
- true if semaphore queue is less or equal to than the max_form_worker_queue depth
-
registerNoCapacityEvent
public void registerNoCapacityEvent()
Manually register a no capacity event. Use to register FormServer not available events.
-
registerRenderMetric
public void registerRenderMetric(Integer renderTime, Integer loadTime, Integer totalTime)
Register the render time, load time and total time rendering metrics.- Parameters:
renderTime
- the render time (ms)loadTime
- the browser load time (ms)totalTime
- the browser load time (ms)
-
getQueueLength
public int getQueueLength()
Return the form worker semaphore queue depth.- Returns:
- the form worker semaphore queue depth.
-
getThreadCount
public int getThreadCount()
Return the form worker current thread count (max threads - available permits).- Returns:
- the form worker current thread count (max threads - available permits)
-
getAndResetNoCapacityEvents
public int getAndResetNoCapacityEvents()
Get and reset the number of no capacity events.- Returns:
- the number of no capacity events
-
getSumRenderMetricAndReset
public FormWorkerController.RenderMetric getSumRenderMetricAndReset()
Return the average render metric for the last period and reset.- Returns:
- the average render metric for the last period and reset.
-
-