Xiaofei's Computer Knowledge Miscellaneous Shop

website·Indexed 29 days ago

https://xiaofei.site/notes/

A collection of technical notes and tutorials covering backend development with Spring Boot, MyBatis, and Redis; database management for MySQL, SQL Server, and Oracle; and infrastructure topics including RabbitMQ, RPC frameworks, and multi-tenant scheduled task architectures. Also includes guides on Vue2, Node.js, Maven configuration, and computer networking fundamentals.

Tokens
195.7K
Snippets
814
Records
1.2K
Agent score
50%

What's inside Xiaofei Notes

  1. Overview of the Java Collection Interface

    The Collection interface is the root interface for all single-column collections in Java. It defines common methods used by all single-column containers to store multiple data elements.
  2. Overview of Java Collection Framework classes

    Java collections are categorized into several main interfaces:

    • List: Ordered collections that allow duplicates.
      • ArrayList: Dynamic array; fast lookups, slow insertions/deletions.
      • LinkedList: Doubly-linked list; slow lookups, fast insertions/deletions.
      • Vector: Thread-safe dynamic array (similar to ArrayList).
    • Set: Collections that contain no duplicate elements.
      • HashSet: Hash table based; unordered.
      • LinkedHashSet: Hash table + linked list; maintains insertion order.
      • TreeSet: Red-Black tree based; sorted.
    • Queue: Designed for holding elements prior to processing.
      • LinkedList: Implements Queue for FIFO (First-In-First-Out) operations.
      • PriorityQueue: Priority heap; sorted by natural order or a custom comparator.
    • Map: Key-value pairs.
      • HashMap: Hash table; unordered; keys must be unique.
      • LinkedHashMap: Hash table + linked list; maintains insertion order.
      • TreeMap: Red-Black tree; sorted by keys; keys cannot be null.
      • ConcurrentHashMap: Thread-safe hash table; neither keys nor values can be null.
  3. Overview of Tobacco Production MES Workflow

    The production process for finished cigarettes involves several integrated systems (MES, WMS, and Control Systems) with the following workflow:

    1. Production Planning: Users create production plans and import them into the MES system, specifying the quantity of cigarette boxes to be produced per machine.
    2. Brand Management: Brand basic information is issued by the China Tobacco master data system. Users maintain process information (quality parameters for silk making and wrapping, and process information) in the MES, which is then sent to the underlying control system for data collection.
    3. Instruction Execution: Production instruction orders (including brand info) are sent to the control system via intermediate tables. The control system returns work order details (shift, start/end time, brand, batch, order number) and updates production status (PLC dispatch, started, completed) via APIs.
    4. Yield Tracking: Yield is tracked via yield confirmation forms linked to work orders. Data is sourced from both the underlying system (automated collection) and manual user entry, requiring an approval process upon completion.
    5. Material Management:
      • Materials are linked to work orders via warehouse entry/exit records.
      • Inbound orders are provided by WMS interfaces; each item in a multi-material document generates a separate record.
      • Material inspection is performed by laboratories, with data transmitted to MES inspection work order details via TCP, UDP, OPC, or serial ports.
    6. Consumption Tracking: WMS provides total material usage per machine. Manual entries are used to record material transfers between machines, and the MES automatically aggregates and calculates totals at the end of each shift.
  4. Overview of Multi-Tenant Scheduled Task Architecture

    The architecture implements tenant isolation by assigning each tenant a dedicated Quartz Scheduler instance and a separate MySQL database. This prevents scheduling conflicts and ensures data isolation. The system uses Spring Boot 2.x, Quartz 2.3.x, Druid 1.2.x for connection pooling, and MyBatis 2.x for data access. Tenant identification is handled via JWT tokens passed in HTTP requests.
  5. Prepare for Java development interviews and career growth

    Resources for Java developers range from core technical guides and system architecture to high-concurrency and distributed systems knowledge.
  6. Understand Spring Boot Starters

    A Spring Boot Starter is a set of dependency descriptors that simplify build configuration. For example, spring-boot-starter-data-redis bundles the necessary dependencies and uses configuration classes, property loading, and spring.factories to enable auto-configuration for Redis.
  7. Understand Java IO Stream fundamentals

    In Java, IO streams are categorized by the direction of data flow and the type of data handled:

    • Input: Reading data from a source (e.g., disk/hard drive) into memory.
    • Output: Writing data from memory to a destination (e.g., disk/hard drive).

    Stream Classifications:

    1. Byte Streams: Handle binary data. Base classes are InputStream and OutputStream.
    2. Character Streams: Handle text data. Base classes are Reader and Writer.
  8. Multi-tenant Scheduler Architecture Components

    The system uses a layered approach to manage tenant isolation:

    Data Source Layer:

    • DynamicDataSource: Extends AbstractRoutingDataSource to route queries based on ThreadLocal.
    • TenantContextFilter: Extracts tenant IDs from JWTs and populates the DynamicDataSourceContextHolder.
    • DruidConfig: Manages the creation and dynamic registration of Druid connection pools.

    Scheduling Layer (wsd-quartz):

    • SchedulerManager: The core manager maintaining a map of tenantId to Scheduler instances.
    • AbstractQuartzJob: Base class that restores tenant context in before() and cleans it up in after().
    • ScheduleUtils: Handles the injection of tenant identifiers into the Quartz JobDataMap.
    • JobInvokeUtil: Uses reflection to call target bean methods via beanName.method(args).