Package org.glassfish.grizzly
Class Writer.Reentrant
- java.lang.Object
-
- org.glassfish.grizzly.Writer.Reentrant
-
-
Constructor Summary
Constructors Constructor Description Reentrant()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
dec()
Decrements the reentrants counter by one.int
get()
Returns the value of the reentrants counter for the current thread.static int
getMaxReentrants()
Returns the maximum number of write() method reentrants a thread is allowed to made.static Writer.Reentrant
getWriteReentrant()
Returns the current write reentrants counter.boolean
inc()
Increments the reentrants counter by one.boolean
isMaxReentrantsReached()
Returns true, if max number of write->completion-handler reentrants has been reached for the passedWriter.Reentrant
object, and next write will happen in the separate thread.
-
-
-
Method Detail
-
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
public static Writer.Reentrant 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.Reentrant
object, 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.Reentrant
object, and next write will happen in the separate thread.
-
-