Using the variable โreservationsโ is a good domain design because it is much more significant than the size, you can use this to express the concept of the domain, for example, the total number of reservations available, etc.
Performance side
ArrayBlockingQueue - the size call function will cause slowness, as it gets a lock to read the size, and this will slow down the operation or perform the operation.
LinkedBlockingQueue Caller size is atomic / volatile and has performance.
Ashkrit sharma
source share