PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Software Engineering Fundamentals/J.P. Morgan

Review a PR for thread-safe request handling

Last updated: Apr 10, 2026

Quick Overview

This question evaluates understanding of thread-safety and concurrent programming, safe object and API design (immutability versus shared mutable state), and reliability concerns involved in constructing and issuing external HTTP requests.

  • medium
  • J.P. Morgan
  • Software Engineering Fundamentals
  • Software Engineer

Review a PR for thread-safe request handling

Company: J.P. Morgan

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Technical Screen

## PR review / debugging prompt (backend) You are reviewing a pull request that introduces a `CustomerRequest` class used by a web service to build and send an **external HTTP request** to a downstream system. The PR has these characteristics: - `CustomerRequest` contains **many fields** (customer identifiers, metadata, optional attributes), most of them **mutable**. - The class is used in a **multi-threaded** context (e.g., requests may be processed concurrently; some instances may be shared via caches/singletons by mistake). - The implementation uses **low-level concurrency primitives**, including at least one `volatile` field to coordinate state (e.g., a lazily initialized token / header map / serialized payload). - The class also triggers or prepares an **external request** (e.g., constructs an HTTP payload, may call a downstream dependency). ### Task 1. List the **main issues/risks** you would call out in the PR (correctness, thread-safety, maintainability, performance, testability, reliability). 2. Propose a **cleaner design** for this request building + external call flow. 3. Describe what you would ask the author to change, including: - safer concurrency patterns (what to avoid, what to use instead) - API/OO design improvements (immutability, validation, builders, separation of concerns) - reliability requirements for the external call (timeouts, retries, idempotency, circuit breaking) - how you would test it (unit/integration/concurrency tests) Assume Java/Kotlin/C#-style server-side development, but keep the answer language-agnostic where possible.

Quick Answer: This question evaluates understanding of thread-safety and concurrent programming, safe object and API design (immutability versus shared mutable state), and reliability concerns involved in constructing and issuing external HTTP requests.

Related Interview Questions

  • Review concurrent code quality - J.P. Morgan (medium)
  • Compute expected value of simple gambling games - J.P. Morgan (easy)
  • Explain C++ virtual dispatch and object lifetime - J.P. Morgan (medium)
J.P. Morgan logo
J.P. Morgan
Feb 8, 2026, 12:00 AM
Software Engineer
Technical Screen
Software Engineering Fundamentals
12
0
Loading...

PR review / debugging prompt (backend)

You are reviewing a pull request that introduces a CustomerRequest class used by a web service to build and send an external HTTP request to a downstream system.

The PR has these characteristics:

  • CustomerRequest contains many fields (customer identifiers, metadata, optional attributes), most of them mutable .
  • The class is used in a multi-threaded context (e.g., requests may be processed concurrently; some instances may be shared via caches/singletons by mistake).
  • The implementation uses low-level concurrency primitives , including at least one volatile field to coordinate state (e.g., a lazily initialized token / header map / serialized payload).
  • The class also triggers or prepares an external request (e.g., constructs an HTTP payload, may call a downstream dependency).

Task

  1. List the main issues/risks you would call out in the PR (correctness, thread-safety, maintainability, performance, testability, reliability).
  2. Propose a cleaner design for this request building + external call flow.
  3. Describe what you would ask the author to change, including:
    • safer concurrency patterns (what to avoid, what to use instead)
    • API/OO design improvements (immutability, validation, builders, separation of concerns)
    • reliability requirements for the external call (timeouts, retries, idempotency, circuit breaking)
    • how you would test it (unit/integration/concurrency tests)

Assume Java/Kotlin/C#-style server-side development, but keep the answer language-agnostic where possible.

Solution

Show

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Software Engineering Fundamentals•More J.P. Morgan•More Software Engineer•J.P. Morgan Software Engineer•J.P. Morgan Software Engineering Fundamentals•Software Engineer Software Engineering Fundamentals
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.