Open Kilda Java Documentation
org.openkilda.messaging.payload.ResourcePool Class Reference

Public Member Functions

 ResourcePool (final Integer minValue, final Integer maxValue)
 
Integer allocate ()
 
Integer allocate (Integer id)
 
Integer deallocate (final Integer resourceId)
 
Set< Integer > dumpPool ()
 
String toString ()
 

Detailed Description

Class represents resource allocator/deallocator.

TODO: (crimi - 2019.04.17) - why is this class in this package?

(crimi - 2019.04.17) - Changing the underlying mechanism here to leverage "max" as the starting point for where to look next. If the counter is at max, then start at zero.

Definition at line 32 of file ResourcePool.java.

Constructor & Destructor Documentation

◆ ResourcePool()

org.openkilda.messaging.payload.ResourcePool.ResourcePool ( final Integer  minValue,
final Integer  maxValue 
)

Instance constructor.

Parameters
minValueminimum resource id value
maxValuemaximum resource id value

Definition at line 47 of file ResourcePool.java.

Member Function Documentation

◆ allocate() [1/2]

Integer org.openkilda.messaging.payload.ResourcePool.allocate ( )

Allocates resource id.

Returns
allocated resource id

Definition at line 58 of file ResourcePool.java.

◆ allocate() [2/2]

Integer org.openkilda.messaging.payload.ResourcePool.allocate ( Integer  id)

Allocates resource id.

Parameters
idresource id
Returns
allocated resource id

Definition at line 88 of file ResourcePool.java.

◆ deallocate()

Integer org.openkilda.messaging.payload.ResourcePool.deallocate ( final Integer  resourceId)

Deallocates previously allocated resource id.

Parameters
resourceIdresource id
Returns
true if specified resource id was previously allocated

Definition at line 103 of file ResourcePool.java.

◆ dumpPool()

Set<Integer> org.openkilda.messaging.payload.ResourcePool.dumpPool ( )

Returns copy of resource pool.

Returns
ImmutableSet of allocated resources id

Definition at line 112 of file ResourcePool.java.

◆ toString()

String org.openkilda.messaging.payload.ResourcePool.toString ( )

Definition at line 120 of file ResourcePool.java.


The documentation for this class was generated from the following file: