mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Startup message to display VM version and size. Also display warnings if not version 1.5 or max. heap size less than (approx) 500MB.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2072 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -134,6 +134,9 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
|
||||
return repoDescriptor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise Descriptors
|
||||
*/
|
||||
public void init()
|
||||
{
|
||||
// initialise descriptors
|
||||
@@ -156,13 +159,36 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
|
||||
{
|
||||
if (serverDescriptor != null)
|
||||
{
|
||||
// log output of version initialised
|
||||
String serverVersion = serverDescriptor.getVersion();
|
||||
String serverEdition = serverDescriptor.getEdition();
|
||||
String repoVersion = repoDescriptor.getVersion();
|
||||
// log output of VM stats
|
||||
Map properties = System.getProperties();
|
||||
String version = (properties.get("java.runtime.version") == null) ? "unknown" : (String)properties.get("java.runtime.version");
|
||||
long maxHeap = Runtime.getRuntime().maxMemory();
|
||||
float maxHeapMB = maxHeap / 1024l;
|
||||
maxHeapMB = maxHeapMB / 1024l;
|
||||
if (logger.isInfoEnabled())
|
||||
{
|
||||
logger.info(String.format("Alfresco JVM - v%s; maximum heap size %.3fMB", version, maxHeapMB));
|
||||
}
|
||||
if (logger.isWarnEnabled())
|
||||
{
|
||||
if (version.startsWith("1.2") || version.startsWith("1.3") || version.startsWith("1.4"))
|
||||
{
|
||||
logger.warn(String.format("Alfresco JVM - WARNING - v1.5 is required; currently using v%s", version));
|
||||
}
|
||||
if (maxHeapMB < 500)
|
||||
{
|
||||
logger.warn(String.format("Alfresco JVM - WARNING - maximum heap size %.3fMB is less than recommended 512MB", maxHeapMB));
|
||||
}
|
||||
}
|
||||
|
||||
if (logger.isInfoEnabled())
|
||||
logger.info("Alfresco started (" + serverEdition + ") - v" + serverVersion + "; repository v" + repoVersion);
|
||||
// log output of version initialised
|
||||
if (logger.isInfoEnabled())
|
||||
{
|
||||
String serverEdition = serverDescriptor.getEdition();
|
||||
String serverVersion = serverDescriptor.getVersion();
|
||||
String repoVersion = repoDescriptor.getVersion();
|
||||
logger.info(String.format("Alfresco started (%s) - v%s; repository v%s", serverEdition, serverVersion, repoVersion));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user