# lzh-1.8-thread-spring-boot-starter **Repository Path**: coding_13/lzh-1.8-thread-spring-boot-starter ## Basic Information - **Project Name**: lzh-1.8-thread-spring-boot-starter - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-08-13 - **Last Updated**: 2025-08-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # lzh-1.8-thread-spring-boot-starter `lzh-1.8-thread-spring-boot-starter` is a Spring Boot-based thread management starter designed to provide flexible and scalable thread execution capabilities. By encapsulating thread pools and thread decorators, it simplifies the management of multithreaded tasks in Spring Boot applications. ## Features - **Thread Pool Support**: Provides a custom thread pool implementation supporting configurations such as core pool size, maximum pool size, task queue, and more. - **Thread Decorator**: Allows extension and customization of threads via the `ThreadDecorator` interface. - **Thread Factory**: Offers a unified mechanism for thread creation, supporting features like thread name prefix and daemon thread settings. - **Scheduled Task Support**: Supports creation of schedulable thread pools for executing timed or periodic tasks. ## Usage Instructions ### 1. Add Dependency Add the following dependency to your `pom.xml` to use this component: ```xml com.lzh lzh-1.8-thread-spring-boot-starter 1.0.0 ``` ### 2. Configure Thread Pool You can directly create and configure a thread pool in code: ```java LzhThreadExecutor executor = new LzhThreadExecutor( 2, 10, 60L, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new LzhThreadFactory("my-pool"), new MyThreadDecorator(), new ThreadPoolExecutor.AbortPolicy() ); ``` ### 3. Submit Tasks Submit tasks using the thread pool: ```java executor.execute(() -> { // Task execution logic }); ``` ### 4. Create Scheduled Tasks Create a scheduled task: ```java ScheduledThreadPoolExecutor scheduledExecutor = LzhThreadExecutor.createScheduledThreadPoolExecutor(2, "scheduled-pool"); scheduledExecutor.scheduleAtFixedRate(() -> { // Scheduled task logic }, 0, 1, TimeUnit.SECONDS); ``` ## Core Components - **LzhThreadExecutor**: Inherits from `ThreadPoolExecutor`, providing enhanced thread pool functionality. - **LzhThreadFactory**: Thread factory class used to create threads with a consistent naming convention. - **ThreadDecorator**: Thread decoration interface used to extend thread behavior. ## Contribution Guide Contributions of code or suggestions are welcome! Please follow these steps: 1. Fork this repository. 2. Create a new branch (`git checkout -b feature/your-feature-name`). 3. Commit your changes (`git commit -am 'Add some feature'`). 4. Push your branch (`git push origin feature/your-feature-name`). 5. Create a Pull Request. ## License This project is licensed under the MIT License. For details, please refer to the [LICENSE](LICENSE) file.