java.lang.Object
org.glassfish.grizzly.Writer.Reentrant
Write reentrants counter
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleandec()Decrements the reentrants counter by one.intget()Returns the value of the reentrants counter for the current thread.static intReturns the maximum number of write() method reentrants a thread is allowed to made.static Writer.ReentrantReturns the current write reentrants counter.booleaninc()Increments the reentrants counter by one.booleanReturns true, if max number of write->completion-handler reentrants has been reached for the passedWriter.Reentrantobject, and next write will happen in the separate thread.
-
Constructor Details
-
Reentrant
public Reentrant()
-
-
Method Details
-
getMaxReentrants
public static int getMaxReentrants()Returns the maximum number of write() method reentrants a thread is allowed to made. This is related to possible write()->onComplete()->write()->... chain, which may grow infinitely and cause StackOverflow. Using maxWriteReentrants value it's possible to limit such a chain.- Returns:
- the maximum number of write() method reentrants a thread is allowed to make.
-
getWriteReentrant
Returns the current write reentrants counter. Might be useful, if developer wants to use custom notification mechanism, based on onWriter.canWrite(org.glassfish.grizzly.Connection)and various write methods.- Returns:
- current reentrants counter
-
get
public int get()Returns the value of the reentrants counter for the current thread. -
inc
public boolean inc()Increments the reentrants counter by one.- Returns:
- true if the counter (after incrementing) didn't reach
getMaxReentrants()limit, or false otherwise.
-
dec
public boolean dec()Decrements the reentrants counter by one.- Returns:
- true if the counter (after decrementing) didn't reach
getMaxReentrants()limit, or false otherwise.
-
isMaxReentrantsReached
public boolean isMaxReentrantsReached()Returns true, if max number of write->completion-handler reentrants has been reached for the passedWriter.Reentrantobject, and next write will happen in the separate thread.- Returns:
- true, if max number of write->completion-handler reentrants has been reached for the passed
Writer.Reentrantobject, and next write will happen in the separate thread.
-