I wonder if I can block thread and do something during blocking or just count time while thread's blocked, because I want to do queue for airplanes. My airports must have only one landing place, so I used queue with only one slot, then use put method:
world.getCities().get(cityID).getQueue().put(request);
Then I want to burn some fuel during landing:
Thread.sleep(500);
fuelTank = fuelTank - 100;
Now airplane can easly land so I use method take():
world.getCities().get(cityID).getQueue().take();
When everything's done next plane can start his landing procedure.
But airplane was waiting 0,5s so his fuel haven't changed and it'll burn the same amount of fuel as this airplane before and this second shoud burn much more.
So again. I need some kind of mechanism counting blocked thread time or do something during blocking.
Thanks in advance.