Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
8 . 2 2 LAB: Timeout manager with PriorityQueue Timeout manager overview A timeout manager stores a priority queue of timeout items, each a (
LAB: Timeout manager with PriorityQueue Timeout manager overview A timeout manager stores a priority queue of timeout items, each a callback method, callback time pair. Ea method is called approximately milliseconds after the timeout is set, where is the delay specified when a timeout item. Ex: At time a millisecond timeout is set for method At time a millisecond timeout is set for method B At time a millisecond timeout i set for method C So the timeout manager should call the callbacks as follows: Call method A at time Call method C at time Call method B at time A timeout item with a callback time the current time is said to be "expired". Millisecondlevel callback precision is often unfeasible. So a timeout manager typically has an update methor by external code every so often, ex: every milliseconds. The manager's update method calls each expired callback method. Step : Inspect Timeoutltem.java Inspect the Timeoutltem class declaration in the read only Timeoutltem.java file. Access Timeoutltem.java b orange arrow next to LabProgram.java at the top of the coding window. The callbackTime private field stol item was added plus the item's delay. Ex: A Timeoutltem created at with a delay of has callbackTi The callbackMethod private field is the method to call after the timeout expires.
LAB: Timeout manager with PriorityQueue
Timeout manager overview
A timeout manager stores a priority queue of timeout items, each a callback method, callback time pair. Ea method is called approximately milliseconds after the timeout is set, where is the delay specified when a timeout item. Ex:
At time a millisecond timeout is set for method
At time a millisecond timeout is set for method B
At time a millisecond timeout i set for method C
So the timeout manager should call the callbacks as follows:
Call method A at time
Call method C at time
Call method B at time
A timeout item with a callback time the current time is said to be "expired".
Millisecondlevel callback precision is often unfeasible. So a timeout manager typically has an update methor by external code every so often, ex: every milliseconds. The manager's update method calls each expired callback method.
Step : Inspect Timeoutltem.java
Inspect the Timeoutltem class declaration in the read only Timeoutltem.java file. Access Timeoutltem.java b orange arrow next to LabProgram.java at the top of the coding window. The callbackTime private field stol item was added plus the item's delay. Ex: A Timeoutltem created at with a delay of has callbackTi The callbackMethod private field is the method to call after the timeout expires.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started