Package com.levigo.jadice.server
Class Limit
- java.lang.Object
-
- com.levigo.jadice.server.Limit
-
- All Implemented Interfaces:
Serializable
,Comparable<Limit>
- Direct Known Subclasses:
NodeCountLimit
,PageCountLimit
,StreamCountLimit
,StreamSizeLimit
,TimeLimit
public abstract class Limit extends Object implements Serializable, Comparable<Limit>
A Limit represents a configuration element used to restrict the way in which aJob
(or rather its Nodes and Workers) is allowed to run. Limits can be applied to Jobs in order to constrain their resource usage and apply restrictions to input, output and intermediate data. Limits can be applied toJob
s andNode
s.The precedence of Limits depends on their
Limit.WhenExceedAction
:- ABORT Limits applied to a Node always take precedence over the Job's ones, even if they are less restrictive, i.e. the Job's ones have a lower bound.
- WARN Limits are merged together so that both—Job and Node limits—are applied to a particular node.
Limits are generally used to ensure the reliable operation of a jadice server installation. However, they are particularly useful when processing data from untrusted, heterogeneous sources. This applies to cases of malicious data where limits help to fend-off denial-of-service attacks, but also to honest, but still corrupt data.
Caveat: Limits are only useful and effective for areas over which jadice server has full control. As soon as external or native code is involved in a processing pipeline, the protection becomes rather limited if not ineffective. Therefore proper security precautions are required for any external code used by jadice server.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Limit.WhenExceedAction
Possible actions to take when the limit has been exceeded.
-
Constructor Summary
Constructors Constructor Description Limit()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract boolean
doesExceed(long count)
abstract boolean
equals(Object obj)
Limit.WhenExceedAction
getExceedAction()
abstract int
hashCode()
void
setExceedAction(Limit.WhenExceedAction exceedAction)
Set theaction
to take when the limit has been exceeded.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
Method Detail
-
getExceedAction
public Limit.WhenExceedAction getExceedAction()
- Returns:
- The action to take when the limit has been exceeded.
(default:Limit.WhenExceedAction.ABORT
)
-
setExceedAction
public void setExceedAction(Limit.WhenExceedAction exceedAction)
Set theaction
to take when the limit has been exceeded.- Parameters:
exceedAction
- The action to take when the limit was exceeded
-
doesExceed
public abstract boolean doesExceed(long count)
-
-