@ManagedObject("Monitor for low resource conditions and activate a low resource mode if detected")
public class LowResourceMonitor
extends org.eclipse.jetty.util.component.ContainerLifeCycle
ThreadPool.isLowOnThreads() if Connector.getExecutor() is
an instance of ThreadPool and setMonitorThreads(boolean) is true.setMaxMemory(long) is non zero then low resources is detected if the JVMs
Runtime instance has Runtime.totalMemory() minus Runtime.freeMemory()
greater than getMaxMemory()setMaxConnections(int) is non zero then low resources is detected if the total number
of connections exceeds getMaxConnections(). This feature is deprecated and replaced by
ConnectionLimit| Modifier and Type | Class | Description |
|---|---|---|
class |
LowResourceMonitor.ConnectorsThreadPoolLowResourceCheck |
|
class |
LowResourceMonitor.MainThreadPoolLowResourceCheck |
|
class |
LowResourceMonitor.MaxConnectionsLowResourceCheck |
|
class |
LowResourceMonitor.MemoryLowResourceCheck |
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener| Constructor | Description |
|---|---|
LowResourceMonitor(Server server) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
addLowResourceCheck(org.eclipse.jetty.server.LowResourceMonitor.LowResourceCheck lowResourceCheck) |
|
protected void |
clearLowResources() |
|
protected void |
doStart() |
|
protected void |
doStop() |
|
protected boolean |
enableLowOnResources(boolean expectedValue,
boolean newValue) |
|
java.util.Set<org.eclipse.jetty.server.LowResourceMonitor.LowResourceCheck> |
getLowResourceChecks() |
|
int |
getLowResourcesIdleTimeout() |
|
java.lang.String |
getLowResourcesReasons() |
|
long |
getLowResourcesStarted() |
|
int |
getMaxConnections() |
Deprecated.
Replaced by ConnectionLimit
|
int |
getMaxLowResourcesTime() |
|
long |
getMaxMemory() |
|
java.util.Collection<Connector> |
getMonitoredConnectors() |
|
protected Connector[] |
getMonitoredOrServerConnectors() |
|
boolean |
getMonitorThreads() |
|
int |
getPeriod() |
|
java.lang.String |
getReasons() |
|
boolean |
isAcceptingInLowResources() |
|
boolean |
isLowOnResources() |
|
protected java.lang.String |
low(java.lang.String reasons,
java.lang.String newReason) |
|
protected void |
monitor() |
|
void |
setAcceptingInLowResources(boolean acceptingInLowResources) |
|
void |
setLowResourceChecks(java.util.Set<org.eclipse.jetty.server.LowResourceMonitor.LowResourceCheck> lowResourceChecks) |
|
protected void |
setLowResources() |
|
void |
setLowResourcesIdleTimeout(int lowResourcesIdleTimeoutMS) |
|
protected void |
setLowResourcesReasons(java.lang.String reasons) |
|
void |
setLowResourcesStarted(long lowStarted) |
|
void |
setMaxConnections(int maxConnections) |
Deprecated.
Replaced by ConnectionLimit
|
void |
setMaxLowResourcesTime(int maxLowResourcesTimeMS) |
|
void |
setMaxMemory(long maxMemoryBytes) |
|
void |
setMonitoredConnectors(java.util.Collection<Connector> monitoredConnectors) |
|
void |
setMonitorThreads(boolean monitorThreads) |
|
void |
setPeriod(int periodMS) |
|
protected void |
setReasons(java.lang.String reasons) |
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop, toStringaddBean, addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isManaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeansprotected final Server _server
public LowResourceMonitor(@Name("server")
Server server)
@ManagedAttribute("True if low available threads status is monitored")
public boolean getMonitorThreads()
public void setMonitorThreads(boolean monitorThreads)
monitorThreads - If true, check connectors executors to see if they are
ThreadPool instances that are low on threads.@ManagedAttribute("The maximum connections allowed for the monitored connectors before low resource handling is activated")
@Deprecated
public int getMaxConnections()
@Deprecated public void setMaxConnections(int maxConnections)
maxConnections - The maximum connections before low resources state is triggered@ManagedAttribute("The reasons the monitored connectors are low on resources")
public java.lang.String getReasons()
protected void setReasons(java.lang.String reasons)
@ManagedAttribute("Are the monitored connectors low on resources?")
public boolean isLowOnResources()
protected boolean enableLowOnResources(boolean expectedValue,
boolean newValue)
@ManagedAttribute("The reason(s) the monitored connectors are low on resources")
public java.lang.String getLowResourcesReasons()
protected void setLowResourcesReasons(java.lang.String reasons)
@ManagedAttribute("Get the timestamp in ms since epoch that low resources state started")
public long getLowResourcesStarted()
public void setLowResourcesStarted(long lowStarted)
@ManagedAttribute("The monitored connectors. If null then all server connectors are monitored")
public java.util.Collection<Connector> getMonitoredConnectors()
public void setMonitoredConnectors(java.util.Collection<Connector> monitoredConnectors)
monitoredConnectors - The collections of Connectors that should be monitored for low resources.protected Connector[] getMonitoredOrServerConnectors()
@ManagedAttribute("If false, new connections are not accepted while in low resources")
public boolean isAcceptingInLowResources()
public void setAcceptingInLowResources(boolean acceptingInLowResources)
@ManagedAttribute("The monitor period in ms")
public int getPeriod()
public void setPeriod(int periodMS)
periodMS - The period in ms to monitor for low resources@ManagedAttribute("The idletimeout in ms to apply to all existing connections when low resources is detected")
public int getLowResourcesIdleTimeout()
public void setLowResourcesIdleTimeout(int lowResourcesIdleTimeoutMS)
lowResourcesIdleTimeoutMS - The timeout in ms to apply to EndPoints when in the low resources state.@ManagedAttribute("The maximum time in ms that low resources condition can persist before lowResourcesIdleTimeout is applied to new connections as well as existing connections")
public int getMaxLowResourcesTime()
public void setMaxLowResourcesTime(int maxLowResourcesTimeMS)
maxLowResourcesTimeMS - The time in milliseconds that a low resource state can persist before the low resource idle timeout is reapplied to all connections@ManagedAttribute("The maximum memory (in bytes) that can be used before low resources is triggered. Memory used is calculated as (totalMemory-freeMemory).")
public long getMaxMemory()
public void setMaxMemory(long maxMemoryBytes)
maxMemoryBytes - The maximum memory in bytes in use before low resources is triggered.public java.util.Set<org.eclipse.jetty.server.LowResourceMonitor.LowResourceCheck> getLowResourceChecks()
public void setLowResourceChecks(java.util.Set<org.eclipse.jetty.server.LowResourceMonitor.LowResourceCheck> lowResourceChecks)
public void addLowResourceCheck(org.eclipse.jetty.server.LowResourceMonitor.LowResourceCheck lowResourceCheck)
protected void monitor()
protected void doStart()
throws java.lang.Exception
doStart in class org.eclipse.jetty.util.component.ContainerLifeCyclejava.lang.Exceptionprotected void doStop()
throws java.lang.Exception
doStop in class org.eclipse.jetty.util.component.ContainerLifeCyclejava.lang.Exceptionprotected void setLowResources()
protected void clearLowResources()
protected java.lang.String low(java.lang.String reasons,
java.lang.String newReason)
Copyright © 1995–2018 Webtide. All rights reserved.