SpringBatch 简介

1. 简介 Spring Batch 是一个基于 Spring 框架的批处理框架,它提供了一组完整的 API 和工具,用于处理大量数据操作,例如读取、处理和写入数据。Spring Batch 具有高度可...

周二 · 2025-02-25 · 4 分钟 · Yuechen

Design a Log Aggregation System

Implement a Log Aggregation System which aggregates logs from various services in a datacenter and provides search APIs. Design the LogAggregator class: LogAggregator(int machines, int services) Initializes the object with machines and services representing the number of machines and services in the datacenter, respectively. void pushLog(int logId, int machineId, int serviceId, String message) Adds a log with id logId notifying that the machine machineId sent a string message while executing...

周日 · 2025-02-23 · 4 分钟 · Yuechen

Design a Rate Limiting System

A Rate Limiting System can allow a maximum of n requests every t seconds, using an implementation similar to the sliding window algorithm. Given two positive integers n and t, and a non-decreasing stream of integers representing the timestamps of requests, implement a data structure that can check if each request is allowed or not. Implement the RateLimiter class: RateLimiter(int n, int t) Initializes the RateLimiter object with an empty...

周六 · 2025-02-22 · 4 分钟 · Yuechen

Design a Todo List

Design a Todo List Where users can add tasks, mark them as complete, or get a list of pending tasks. Users can also add tags to tasks and can filter the tasks by certain tags. Implement the TodoList class: TodoList() Initializes the object. int addTask(int userId, String taskDescription, int dueDate, List<String> tags) Adds a task for the user with the ID userId with a due date equal to dueDate and...

周日 · 2025-02-16 · 4 分钟 · Yuechen

Design Walnut

Design a banking SMS parsing and analytics application (like Walnut) which reads all the text messages received by users and analyzes the following: The income and expenditure of a user. The average income and expenditure of all users. Text messages will be represented as a string, with words separated by ' '. The texts will be analyzed and will be considered valid if it satisfies the following criteria: It contains...

周日 · 2025-01-19 · 4 分钟 · Yuechen

"Effective Java"精读之序列化

1. 避免序列化 序列化是一种强大的功能,但也会带来许多问题,特别是在版本控制和安全性方面。应避免不必要的序列化。 总结: 如果不需要对象的序列化能力...

周日 · 2025-01-12 · 3 分钟 · Yuechen

"Effective Java"精读之并发

1. 同步访问共享可变数据 当多个线程访问共享可变数据时,必须进行同步,以防止数据竞争和一致性问题。 总结: 为了确保线程安全,必须在访问共享可变数据...

周日 · 2025-01-12 · 4 分钟 · Yuechen

"Effective Java"精读之异常

1. 仅在异常条件下使用异常 异常应仅用于表示程序中的异常情况,而不是作为正常控制流的一部分。异常的使用不当会使代码复杂且效率低下。 总结: 异常应仅...

周日 · 2025-01-12 · 4 分钟 · Yuechen