use of org.alfresco.jlan.server.config.CoreServerConfigSection in project alfresco-repository by Alfresco.
the class ContentContext method startFilesystem.
/**
* Start the filesystem
*
* @param share DiskSharedDevice
* @exception DeviceContextException
*/
public void startFilesystem(DiskSharedDevice share) throws DeviceContextException {
// Call the base class
super.startFilesystem(share);
if (getStateCache() != null)
getStateCache().setCaseSensitive(false);
// Find the thread pool via the configuration
CoreServerConfigSection coreConfig = (CoreServerConfigSection) share.getConfiguration().getConfigSection(CoreServerConfigSection.SectionName);
if (coreConfig != null)
m_threadPool = coreConfig.getThreadPool();
if (getLockManager() != null) {
// Start the lock manager
m_lockManager.startLockManager("OplockExpire_" + share.getName(), m_threadPool);
}
if (m_nodeMonitor != null)
m_nodeMonitor.startMonitor();
}
use of org.alfresco.jlan.server.config.CoreServerConfigSection in project alfresco-repository by Alfresco.
the class ServerConfigurationBean method processCoreServerConfig.
/**
* Process the core server configuration
*
* @exception InvalidConfigurationException
*/
protected void processCoreServerConfig() throws InvalidConfigurationException {
// Create the core server configuration section
CoreServerConfigSection coreConfig = new CoreServerConfigSection(this);
if (coreServerConfigBean == null) {
// Configure a default memory pool
coreConfig.setMemoryPool(DefaultMemoryPoolBufSizes, DefaultMemoryPoolInitAlloc, DefaultMemoryPoolMaxAlloc);
// Configure a default thread pool size
coreConfig.setThreadPool(DefaultThreadPoolInit, DefaultThreadPoolMax);
threadPool = coreConfig.getThreadPool();
return;
}
// Check if the thread pool size has been specified
Integer initSize = coreServerConfigBean.getThreadPoolInit();
if (initSize == null) {
initSize = DefaultThreadPoolInit;
}
Integer maxSize = coreServerConfigBean.getThreadPoolMax();
if (maxSize == null) {
maxSize = DefaultThreadPoolMax;
}
if (initSize < ThreadRequestPool.MinimumWorkerThreads)
throw new InvalidConfigurationException("Thread pool size below minimum allowed size");
if (initSize > ThreadRequestPool.MaximumWorkerThreads)
throw new InvalidConfigurationException("Thread pool size above maximum allowed size");
if (maxSize < ThreadRequestPool.MinimumWorkerThreads)
throw new InvalidConfigurationException("Thread pool maximum size below minimum allowed size");
if (maxSize > ThreadRequestPool.MaximumWorkerThreads)
throw new InvalidConfigurationException("Thread pool maximum size above maximum allowed size");
if (maxSize < initSize)
throw new InvalidConfigurationException("Initial size is larger than maxmimum size");
// Configure the thread pool
coreConfig.setThreadPool(initSize, maxSize);
threadPool = coreConfig.getThreadPool();
if (coreServerConfigBean.getThreadPoolDebug())
coreConfig.getThreadPool().setDebug(true);
// Check if the packet sizes/allocations have been specified
List<MemoryPacketConfigBean> packetSizes = coreServerConfigBean.getMemoryPacketSizes();
if (packetSizes != null) {
// Calculate the array size for the packet size/allocation arrays
int elemCnt = packetSizes.size();
// Create the packet size, initial allocation and maximum allocation arrays
int[] pktSizes = new int[elemCnt];
int[] initSizes = new int[elemCnt];
int[] maxSizes = new int[elemCnt];
int elemIdx = 0;
// Process the packet size elements
for (MemoryPacketConfigBean curChild : packetSizes) {
// Get the packet size
int pktSize = -1;
Long pktSizeLong = curChild.getSize();
if (pktSizeLong == null)
throw new InvalidConfigurationException("Memory pool packet size not specified");
try {
pktSize = MemorySize.getByteValueInt(pktSizeLong.toString());
} catch (NumberFormatException ex) {
throw new InvalidConfigurationException("Memory pool packet size, invalid size value, " + pktSizeLong);
}
if (elemIdx > 0 && pktSizes[elemIdx - 1] >= pktSize)
throw new InvalidConfigurationException("Invalid packet size specified, less than/equal to previous packet size");
// Get the initial allocation for the current packet size
Integer initAlloc = curChild.getInit();
if (initAlloc == null)
throw new InvalidConfigurationException("Memory pool initial allocation not specified");
if (initAlloc < MemoryPoolMinimumAllocation)
throw new InvalidConfigurationException("Initial memory pool allocation below minimum of " + MemoryPoolMinimumAllocation);
if (initAlloc > MemoryPoolMaximumAllocation)
throw new InvalidConfigurationException("Initial memory pool allocation above maximum of " + MemoryPoolMaximumAllocation);
// Get the maximum allocation for the current packet size
Integer maxAlloc = curChild.getMax();
if (maxAlloc == null)
throw new InvalidConfigurationException("Memory pool maximum allocation not specified");
if (maxAlloc < MemoryPoolMinimumAllocation)
throw new InvalidConfigurationException("Maximum memory pool allocation below minimum of " + MemoryPoolMinimumAllocation);
if (initAlloc > MemoryPoolMaximumAllocation)
throw new InvalidConfigurationException("Maximum memory pool allocation above maximum of " + MemoryPoolMaximumAllocation);
// Set the current packet size elements
pktSizes[elemIdx] = pktSize;
initSizes[elemIdx] = initAlloc;
maxSizes[elemIdx] = maxAlloc;
elemIdx++;
}
if (elemIdx < pktSizes.length) {
// Re-allocate the packet size/allocation arrays
int[] newPktSizes = new int[elemIdx];
int[] newInitSizes = new int[elemIdx];
int[] newMaxSizes = new int[elemIdx];
// Copy the values to the shorter arrays
System.arraycopy(pktSizes, 0, newPktSizes, 0, elemIdx);
System.arraycopy(initSizes, 0, newInitSizes, 0, elemIdx);
System.arraycopy(maxSizes, 0, newMaxSizes, 0, elemIdx);
// Move the new arrays into place
pktSizes = newPktSizes;
initSizes = newInitSizes;
maxSizes = newMaxSizes;
}
// Configure the memory pool
coreConfig.setMemoryPool(pktSizes, initSizes, maxSizes);
} else {
// Configure a default memory pool
coreConfig.setMemoryPool(DefaultMemoryPoolBufSizes, DefaultMemoryPoolInitAlloc, DefaultMemoryPoolMaxAlloc);
}
}
Aggregations