Class TimedSemaphore.Builder
- java.lang.Object
-
- org.apache.commons.lang3.concurrent.TimedSemaphore.Builder
-
- All Implemented Interfaces:
java.util.function.Supplier<TimedSemaphore>
- Enclosing class:
- TimedSemaphore
public static class TimedSemaphore.Builder extends java.lang.Object implements java.util.function.Supplier<TimedSemaphore>
Builds newTimedSemaphore.- Since:
- 3.20.0
-
-
Constructor Summary
Constructors Constructor Description Builder()Constructs a new Builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TimedSemaphoreget()TimedSemaphore.BuildersetLimit(int limit)Sets the limit.TimedSemaphore.BuildersetPeriod(long period)Sets the time period.TimedSemaphore.BuildersetService(java.util.concurrent.ScheduledExecutorService service)Sets the executor service.TimedSemaphore.BuildersetTimeUnit(java.util.concurrent.TimeUnit timeUnit)Sets the time unit for the period.
-
-
-
Method Detail
-
get
public TimedSemaphore get()
- Specified by:
getin interfacejava.util.function.Supplier<TimedSemaphore>
-
setLimit
public TimedSemaphore.Builder setLimit(int limit)
Sets the limit.- Parameters:
limit- The limit.- Returns:
thisinstance.
-
setPeriod
public TimedSemaphore.Builder setPeriod(long period)
Sets the time period.- Parameters:
period- The time period.- Returns:
thisinstance.
-
setService
public TimedSemaphore.Builder setService(java.util.concurrent.ScheduledExecutorService service)
Sets the executor service.- Parameters:
service- The executor service.- Returns:
thisinstance.
-
setTimeUnit
public TimedSemaphore.Builder setTimeUnit(java.util.concurrent.TimeUnit timeUnit)
Sets the time unit for the period.- Parameters:
timeUnit- The time unit for the period.- Returns:
thisinstance.
-
-