public class ModuleGeneratorQueue extends Object implements org.springframework.beans.factory.InitializingBean
| Modifier and Type | Field and Description |
|---|---|
static String |
HAS_PROCESSING_SEMAPHORE_PARAM |
| Constructor and Description |
|---|
ModuleGeneratorQueue() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet()
Invoked by a BeanFactory after it has set all bean properties supplied
(and satisfied BeanFactoryAware and ApplicationContextAware).
|
Semaphore |
getAvailableProcessings()
Available processings is a Semaphore that allow multiple threads to generate fragments in parallel
the number of parallel processings is configurable using "maxModulesToGenerateInParallel" property
|
protected void |
getFragmentsGenerationPermit(String resourceIdentifier,
javax.servlet.http.HttpServletRequest request)
Number of threads generating fragments in parallel is limited, this function is used to get the permission to generate a page
based on the property "maxModulesToGenerateInParallel".
|
Map<String,CountDownLatch> |
getGeneratingModules() |
protected boolean |
getLatch(RenderContext renderContext,
String finalKey)
Get a latch for the given fragment key, this key will be unavailable for all other threads until the thread that put the latch
call the releaseLatch function.
|
int |
getMaxModulesToGenerateInParallel() |
long |
getMinimumIntervalAfterLastAutoThreadDump() |
long |
getModuleGenerationWaitTime() |
Map<String,String> |
getNotCacheableModule() |
boolean |
isThreadDumpToFile() |
boolean |
isThreadDumpToSystemOut() |
protected void |
releaseFragmentsGenerationPermit(javax.servlet.http.HttpServletRequest request)
Release a permit previously set for the current thread, this function is used when the current thread just finish
a page generation.
|
protected void |
releaseLatch(String finalKey)
Release latch, this will signal that the current thread have finish its work
All the other waiting threads will be free to get/read the resource generated by the first thread
This function also handle the maximum allowed fragment generation in parallel internally (based on maxModulesToGenerateInParallel property)
The permit is automatically released, no need to do additional call to release the permit.
|
void |
setMaxModulesToGenerateInParallel(int maxModulesToGenerateInParallel) |
void |
setMinimumIntervalAfterLastAutoThreadDump(long minimumIntervalAfterLastAutoThreadDump) |
void |
setModuleGenerationWaitTime(long moduleGenerationWaitTime) |
void |
setThreadDumpToFile(boolean threadDumpToFile) |
void |
setThreadDumpToSystemOut(boolean threadDumpToSystemOut) |
public static final String HAS_PROCESSING_SEMAPHORE_PARAM
public Map<String,CountDownLatch> getGeneratingModules()
public Semaphore getAvailableProcessings()
protected void getFragmentsGenerationPermit(String resourceIdentifier, javax.servlet.http.HttpServletRequest request)
resourceIdentifier - Identifier for the current resource, could be the cache key if available, or anything that could identify the resource ( only use for log purpose )request - the current requestprotected void releaseFragmentsGenerationPermit(javax.servlet.http.HttpServletRequest request)
request - the current requestprotected boolean getLatch(RenderContext renderContext, String finalKey) throws Exception
renderContext - current RenderContextfinalKey - fragment keyExceptionprotected void releaseLatch(String finalKey)
public int getMaxModulesToGenerateInParallel()
public long getModuleGenerationWaitTime()
public void afterPropertiesSet()
throws Exception
This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanException - in the event of misconfiguration (such
as failure to set an essential property) or if initialization fails.public void setMaxModulesToGenerateInParallel(int maxModulesToGenerateInParallel)
public void setModuleGenerationWaitTime(long moduleGenerationWaitTime)
public void setMinimumIntervalAfterLastAutoThreadDump(long minimumIntervalAfterLastAutoThreadDump)
public long getMinimumIntervalAfterLastAutoThreadDump()
public boolean isThreadDumpToSystemOut()
public void setThreadDumpToSystemOut(boolean threadDumpToSystemOut)
public boolean isThreadDumpToFile()
public void setThreadDumpToFile(boolean threadDumpToFile)
Copyright © 2004–2020 Jahia Solutions Group SA. All rights reserved.