Top Description Inners Fields Constructors Methods
org.eclipse.jetty.server

public Class LowResourceMonitor

extends ContainerLifeCycle
Class Inheritance
Annotations
@ManagedObject:Monitor for low resource conditions and activate a low resource mode if detected
Imports
java.util.Arrays, .Collection, .Collections, .HashSet, .Set, java.util.concurrent.Executor, .TimeUnit, java.util.concurrent.atomic.AtomicBoolean, org.eclipse.jetty.io.EndPoint, org.eclipse.jetty.util.annotation.ManagedAttribute, .ManagedObject, .Name, org.eclipse.jetty.util.component.ContainerLifeCycle, org.eclipse.jetty.util.thread.ScheduledExecutorScheduler, .Scheduler, .ThreadPool, org.slf4j.Logger, .LoggerFactory

A monitor for low resources, low resources can be detected by:

Nested and Inner Type Summary

Modifier and TypeClass and Description
public class
public static interface
private static class
public class
public class
public class

Field Summary

Modifier and TypeField and Description
private Set<AbstractConnector>
private boolean
private final AtomicBoolean
private Set<LowResourceMonitor.LowResourceCheck>
private int
private long
private int
private final Runnable
private Connector[]
private int
private String
private Scheduler
protected final Server
private static final Logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
protected void
protected void
doStart()

Overrides org.eclipse.jetty.util.component.ContainerLifeCycle.doStart.

Starts the managed lifecycle beans in the order they were added.
protected void
doStop()

Overrides org.eclipse.jetty.util.component.ContainerLifeCycle.doStop.

Stops the managed lifecycle beans in the reverse order they were added.
protected boolean
enableLowOnResources(boolean expectedValue, boolean newValue)

public Set<LowResourceMonitor.LowResourceCheck>
public int
public String
public long
public int
public long
public Collection<Connector>
protected Connector[]
public boolean
public int
public String
public boolean
public boolean
protected String
low(String reasons, String newReason)

protected void
public void
setAcceptingInLowResources(boolean acceptingInLowResources)

public void
protected void
public void
setLowResourcesIdleTimeout(int
The timeout in ms to apply to EndPoints when in the low resources state.
lowResourcesIdleTimeoutMS
)

protected void
public void
setLowResourcesStarted(long lowStarted)

public void
setMaxLowResourcesTime(int
The time in milliseconds that a low resource state can persist before the low resource idle timeout is reapplied to all connections
maxLowResourcesTimeMS
)

public void
setMaxMemory(long
The maximum memory in bytes in use before low resources is triggered.
maxMemoryBytes
)

public void
setMonitoredConnectors(Collection<Connector>
The collections of Connectors that should be monitored for low resources.
monitoredConnectors
)

public void
setMonitorThreads(boolean
If true, check connectors executors to see if they are ThreadPool instances that are low on threads.
monitorThreads
)

public void
setPeriod(int
The period in ms to monitor for low resources
periodMS
)

protected void
setReasons(String reasons)

Inherited from org.eclipse.jetty.util.component.ContainerLifeCycle:
addBeanaddBeanaddEventListeneraddManagedcontainsdestroydumpdumpdumpdumpObjectsdumpStdErrgetBeangetBeansgetBeansgetContainedBeansgetContainedBeansisAutoisManagedisUnmanagedmanageremoveBeanremoveBeansremoveEventListenersetBeansstartstopunmanageupdateBeanupdateBeanupdateBeansupdateBeans

Field Detail

_acceptingConnectorsback to summary
private Set<AbstractConnector> _acceptingConnectors
_acceptingInLowResourcesback to summary
private boolean _acceptingInLowResources
_lowback to summary
private final AtomicBoolean _low
_lowResourceChecksback to summary
private Set<LowResourceMonitor.LowResourceCheck> _lowResourceChecks
_lowResourcesIdleTimeoutback to summary
private int _lowResourcesIdleTimeout
_lowStartedback to summary
private long _lowStarted
_maxLowResourcesTimeback to summary
private int _maxLowResourcesTime
_monitorback to summary
private final Runnable _monitor
_monitoredConnectorsback to summary
private Connector[] _monitoredConnectors
_periodback to summary
private int _period
_reasonsback to summary
private String _reasons
_schedulerback to summary
private Scheduler _scheduler
_serverback to summary
protected final Server _server
LOGback to summary
private static final Logger LOG

Hides org.eclipse.jetty.util.component.ContainerLifeCycle.LOG.

Constructor Detail

LowResourceMonitorback to summary
public LowResourceMonitor(Server server)

Method Detail

addLowResourceCheckback to summary
public void addLowResourceCheck(LowResourceMonitor.LowResourceCheck lowResourceCheck)
clearLowResourcesback to summary
protected void clearLowResources()
doStartback to summary
protected void doStart() throws Exception

Overrides org.eclipse.jetty.util.component.ContainerLifeCycle.doStart.

Doc from org.eclipse.jetty.util.component.ContainerLifeCycle.doStart.

Starts the managed lifecycle beans in the order they were added.

Annotations
@Override
Exceptions
Exception:

Doc from org.eclipse.jetty.util.component.AbstractLifeCycle.doStart.

If there was a problem starting. Will cause a transition to FAILED state

doStopback to summary
protected void doStop() throws Exception

Overrides org.eclipse.jetty.util.component.ContainerLifeCycle.doStop.

Doc from org.eclipse.jetty.util.component.ContainerLifeCycle.doStop.

Stops the managed lifecycle beans in the reverse order they were added.

Annotations
@Override
Exceptions
Exception:

Doc from org.eclipse.jetty.util.component.AbstractLifeCycle.doStop.

If there was a problem stopping. Will cause a transition to FAILED state

enableLowOnResourcesback to summary
protected boolean enableLowOnResources(boolean expectedValue, boolean newValue)
getLowResourceChecksback to summary
public Set<LowResourceMonitor.LowResourceCheck> getLowResourceChecks()
getLowResourcesIdleTimeoutback to summary
public int getLowResourcesIdleTimeout()
Annotations
@ManagedAttribute:The idletimeout in ms to apply to all existing connections when low resources is detected
getLowResourcesReasonsback to summary
public String getLowResourcesReasons()
Annotations
@ManagedAttribute:The reason(s) the monitored connectors are low on resources
getLowResourcesStartedback to summary
public long getLowResourcesStarted()
Annotations
@ManagedAttribute:Get the timestamp in ms since epoch that low resources state started
getMaxLowResourcesTimeback to summary
public int getMaxLowResourcesTime()
Annotations
@ManagedAttribute:The maximum time in ms that low resources condition can persist before lowResourcesIdleTimeout is applied to new connections as well as existing connections
getMaxMemoryback to summary
public long getMaxMemory()
Annotations
@ManagedAttribute:The maximum memory (in bytes) that can be used before low resources is triggered. Memory used is calculated as (totalMemory-freeMemory).
getMonitoredConnectorsback to summary
public Collection<Connector> getMonitoredConnectors()
Annotations
@ManagedAttribute:The monitored connectors. If null then all server connectors are monitored
getMonitoredOrServerConnectorsback to summary
protected Connector[] getMonitoredOrServerConnectors()
getMonitorThreadsback to summary
public boolean getMonitorThreads()
Annotations
@ManagedAttribute:True if low available threads status is monitored
getPeriodback to summary
public int getPeriod()
Annotations
@ManagedAttribute:The monitor period in ms
getReasonsback to summary
public String getReasons()
Annotations
@ManagedAttribute:The reasons the monitored connectors are low on resources
isAcceptingInLowResourcesback to summary
public boolean isAcceptingInLowResources()
Annotations
@ManagedAttribute:If false, new connections are not accepted while in low resources
isLowOnResourcesback to summary
public boolean isLowOnResources()
Annotations
@ManagedAttribute:Are the monitored connectors low on resources?
lowback to summary
protected String low(String reasons, String newReason)
monitorback to summary
protected void monitor()
setAcceptingInLowResourcesback to summary
public void setAcceptingInLowResources(boolean acceptingInLowResources)
setLowResourceChecksback to summary
public void setLowResourceChecks(Set<LowResourceMonitor.LowResourceCheck> lowResourceChecks)
setLowResourcesback to summary
protected void setLowResources()
setLowResourcesIdleTimeoutback to summary
public void setLowResourcesIdleTimeout(int lowResourcesIdleTimeoutMS)
Parameters
lowResourcesIdleTimeoutMS:int

The timeout in ms to apply to EndPoints when in the low resources state.

setLowResourcesReasonsback to summary
protected void setLowResourcesReasons(String reasons)
setLowResourcesStartedback to summary
public void setLowResourcesStarted(long lowStarted)
setMaxLowResourcesTimeback to summary
public void setMaxLowResourcesTime(int maxLowResourcesTimeMS)
Parameters
maxLowResourcesTimeMS:int

The time in milliseconds that a low resource state can persist before the low resource idle timeout is reapplied to all connections

setMaxMemoryback to summary
public void setMaxMemory(long maxMemoryBytes)
Parameters
maxMemoryBytes:long

The maximum memory in bytes in use before low resources is triggered.

setMonitoredConnectorsback to summary
public void setMonitoredConnectors(Collection<Connector> monitoredConnectors)
Parameters
monitoredConnectors:Collection<Connector>

The collections of Connectors that should be monitored for low resources.

setMonitorThreadsback to summary
public void setMonitorThreads(boolean monitorThreads)
Parameters
monitorThreads:boolean

If true, check connectors executors to see if they are ThreadPool instances that are low on threads.

setPeriodback to summary
public void setPeriod(int periodMS)
Parameters
periodMS:int

The period in ms to monitor for low resources

setReasonsback to summary
protected void setReasons(String reasons)
org.eclipse.jetty.server back to summary

public Class LowResourceMonitor.ConnectorsThreadPoolLowResourceCheck

extends Object
implements LowResourceCheck
Class Inheritance
  • java.lang.Object
  • org.eclipse.jetty.server.LowResourceMonitor.ConnectorsThreadPoolLowResourceCheck
All Implemented Interfaces
org.eclipse.jetty.server.LowResourceMonitor.LowResourceCheck

Field Summary

Modifier and TypeField and Description
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
public boolean
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

reasonback to summary
private String reason

Constructor Detail

ConnectorsThreadPoolLowResourceCheckback to summary
public ConnectorsThreadPoolLowResourceCheck()

Method Detail

getReasonback to summary
public String getReason()

Implements org.eclipse.jetty.server.LowResourceMonitor.LowResourceCheck.getReason.

Annotations
@Override
isLowOnResourcesback to summary
public boolean isLowOnResources()

Implements org.eclipse.jetty.server.LowResourceMonitor.LowResourceCheck.isLowOnResources.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
org.eclipse.jetty.server back to summary

public Interface LowResourceMonitor.LowResourceCheck

Known Direct Implementers
org.eclipse.jetty.server.LowResourceMonitor.MainThreadPoolLowResourceCheck, org.eclipse.jetty.server.LowResourceMonitor.ConnectorsThreadPoolLowResourceCheck, org.eclipse.jetty.server.LowResourceMonitor.MaxConnectionsLowResourceCheck, org.eclipse.jetty.server.LowResourceMonitor.MemoryLowResourceCheck

Method Summary

Modifier and TypeMethod and Description
public String
public boolean

Method Detail

getReasonback to summary
public String getReason()
isLowOnResourcesback to summary
public boolean isLowOnResources()
org.eclipse.jetty.server back to summary

private Class LowResourceMonitor.LRMScheduler

extends ScheduledExecutorScheduler
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from org.eclipse.jetty.util.thread.ScheduledExecutorScheduler:
doStartdoStopdumpdumpgetNamegetThreadsisDaemonschedule

Constructor Detail

LRMSchedulerback to summary
private LRMScheduler()
org.eclipse.jetty.server back to summary

public Class LowResourceMonitor.MainThreadPoolLowResourceCheck

extends Object
implements LowResourceCheck
Class Inheritance
  • java.lang.Object
  • org.eclipse.jetty.server.LowResourceMonitor.MainThreadPoolLowResourceCheck
All Implemented Interfaces
org.eclipse.jetty.server.LowResourceMonitor.LowResourceCheck

Field Summary

Modifier and TypeField and Description
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
public boolean
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

reasonback to summary
private String reason

Constructor Detail

MainThreadPoolLowResourceCheckback to summary
public MainThreadPoolLowResourceCheck()

Method Detail

getReasonback to summary
public String getReason()

Implements org.eclipse.jetty.server.LowResourceMonitor.LowResourceCheck.getReason.

Annotations
@Override
isLowOnResourcesback to summary
public boolean isLowOnResources()

Implements org.eclipse.jetty.server.LowResourceMonitor.LowResourceCheck.isLowOnResources.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
org.eclipse.jetty.server back to summary

public Class LowResourceMonitor.MaxConnectionsLowResourceCheck

extends Object
implements LowResourceCheck
Class Inheritance
  • java.lang.Object
  • org.eclipse.jetty.server.LowResourceMonitor.MaxConnectionsLowResourceCheck
All Implemented Interfaces
org.eclipse.jetty.server.LowResourceMonitor.LowResourceCheck
Annotations
@ManagedObject:Check max allowed connections on connectors

Field Summary

Modifier and TypeField and Description
private int
private String

Constructor Summary

AccessConstructor and Description
public
MaxConnectionsLowResourceCheck(int maxConnections)

Method Summary

Modifier and TypeMethod and Description
public String
public boolean
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

maxConnectionsback to summary
private int maxConnections
reasonback to summary
private String reason

Constructor Detail

MaxConnectionsLowResourceCheckback to summary
public MaxConnectionsLowResourceCheck(int maxConnections)

Method Detail

getReasonback to summary
public String getReason()

Implements org.eclipse.jetty.server.LowResourceMonitor.LowResourceCheck.getReason.

Annotations
@Override
isLowOnResourcesback to summary
public boolean isLowOnResources()

Implements org.eclipse.jetty.server.LowResourceMonitor.LowResourceCheck.isLowOnResources.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
org.eclipse.jetty.server back to summary

public Class LowResourceMonitor.MemoryLowResourceCheck

extends Object
implements LowResourceCheck
Class Inheritance
  • java.lang.Object
  • org.eclipse.jetty.server.LowResourceMonitor.MemoryLowResourceCheck
All Implemented Interfaces
org.eclipse.jetty.server.LowResourceMonitor.LowResourceCheck

Field Summary

Modifier and TypeField and Description
private long
private String

Constructor Summary

AccessConstructor and Description
public
MemoryLowResourceCheck(long maxMemory)

Method Summary

Modifier and TypeMethod and Description
public long
public String
public boolean
public void
setMaxMemory(long
The maximum memory in bytes in use before low resources is triggered.
maxMemoryBytes
)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

maxMemoryback to summary
private long maxMemory
reasonback to summary
private String reason

Constructor Detail

MemoryLowResourceCheckback to summary
public MemoryLowResourceCheck(long maxMemory)

Method Detail

getMaxMemoryback to summary
public long getMaxMemory()
getReasonback to summary
public String getReason()

Implements org.eclipse.jetty.server.LowResourceMonitor.LowResourceCheck.getReason.

Annotations
@Override
isLowOnResourcesback to summary
public boolean isLowOnResources()

Implements org.eclipse.jetty.server.LowResourceMonitor.LowResourceCheck.isLowOnResources.

Annotations
@Override
setMaxMemoryback to summary
public void setMaxMemory(long maxMemoryBytes)
Parameters
maxMemoryBytes:long

The maximum memory in bytes in use before low resources is triggered.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override