Count objects across framework lifetimes

An image-processing framework manages application objects during one run. It opens sessions A, B, and C in that order, finishing all jobs in one session before opening the next. Their workloads are:


Session

Number of jobs

Jobs requesting a preview

A

3

First and third

B

2

None

C

4

Second and fourth


The framework applies these object-management rules:

  • It constructs one CodecRegistry at startup and retains it until shutdown.
  • It constructs one SessionContext when each session opens. All session contexts remain live until shutdown, including those belonging to finished sessions.
  • It constructs a new JobAdapter for each job. Jobs never overlap, and each adapter stops being live before the next job begins.
  • It constructs a PreviewCache when a session first requests a preview. Later preview requests in that same session reuse its cache. Every constructed cache remains live until shutdown.

There are no pre-existing instances of these four classes, no retries, and no additional instances beyond those specified. Here, an object is live while the framework retains it; garbage-collection timing is irrelevant.


Complete the table with exact integer counts. For each class, distinguish the total number of instances constructed during the run from the maximum number live at any one time.

ClassTotal instances constructedMaximum simultaneously live instances
CodecRegistry
SessionContext
JobAdapter
PreviewCache

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Object-Oriented Frameworks Questions: