{"id":36420568,"url":"https://github.com/nextopcn/lite-pool","last_synced_at":"2026-01-11T17:33:00.193Z","repository":{"id":28855136,"uuid":"119527744","full_name":"nextopcn/lite-pool","owner":"nextopcn","description":"A lite fast object pool","archived":false,"fork":false,"pushed_at":"2022-01-05T03:07:47.000Z","size":434,"stargazers_count":47,"open_issues_count":0,"forks_count":17,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-07-12T14:25:41.455Z","etag":null,"topics":["fast","java","lite","object-pool","pool"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nextopcn.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-30T11:39:34.000Z","updated_at":"2025-04-05T02:56:24.000Z","dependencies_parsed_at":"2022-08-07T14:00:52.368Z","dependency_job_id":null,"html_url":"https://github.com/nextopcn/lite-pool","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/nextopcn/lite-pool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextopcn%2Flite-pool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextopcn%2Flite-pool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextopcn%2Flite-pool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextopcn%2Flite-pool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nextopcn","download_url":"https://codeload.github.com/nextopcn/lite-pool/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextopcn%2Flite-pool/sbom","scorecard":{"id":682354,"data":{"date":"2025-08-11","repo":{"name":"github.com/nextopcn/lite-pool","commit":"589e181e5502323188c6ddf4ebca09b34cb8cb71"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/20 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'","Warn: branch protection not enabled for branch '1.0.0-RC3'","Warn: branch protection not enabled for branch '1.0.0-RC2'","Warn: branch protection not enabled for branch '1.0.0-RC1'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 10 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T23:36:16.653Z","repository_id":28855136,"created_at":"2025-08-21T23:36:16.654Z","updated_at":"2025-08-21T23:36:16.654Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28315879,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T14:58:17.114Z","status":"ssl_error","status_checked_at":"2026-01-11T14:55:53.580Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fast","java","lite","object-pool","pool"],"created_at":"2026-01-11T17:32:59.432Z","updated_at":"2026-01-11T17:33:00.187Z","avatar_url":"https://github.com/nextopcn.png","language":"Java","readme":"Table of Contents([中文说明](./README.zh_CN.md))\n=================\n\n   * [1. Lite-pool](#1-lite-pool)\n      * [1.1. Brief introduction](#11-brief-introduction)\n      * [1.2. Requirements](#12-requirements)\n      * [1.3. Maven dependency](#13-maven-dependency)\n      * [1.4. Install from source code](#14-install-from-source-code)\n   * [2. Usage](#2-usage)\n      * [2.1. PoolBuilder](#21-poolbuilder)\n      * [2.2. Standalone usage](#22-standalone-usage)\n      * [2.3. Spring integration](#23-spring-integration)\n   * [3. PoolListener](#3-poollistener)\n   * [4. Write your own PoolAllocator](#4-write-your-own-poolallocator)\n   * [5. JMX](#5-jmx)\n   * [6. Benchmark](#6-benchmark)\n\n\n# 1. Lite-pool  \n## 1.1. Brief introduction  \n[![Build Status](https://travis-ci.org/nextopcn/lite-pool.svg?branch=master)](https://travis-ci.org/nextopcn/lite-pool)\n[![Coverage Status](https://coveralls.io/repos/github/nextopcn/lite-pool/badge.svg?branch=master)](https://coveralls.io/github/nextopcn/lite-pool?branch=master)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/cn.nextop/lite-pool/badge.svg)](https://maven-badges.herokuapp.com/maven-central/cn.nextop/lite-pool)\n[![Javadocs](http://www.javadoc.io/badge/cn.nextop/lite-pool.svg)](http://www.javadoc.io/doc/cn.nextop/lite-pool)\n[![Hex.pm](https://img.shields.io/hexpm/l/plug.svg?maxAge=2592000)](https://github.com/nextopcn/lite-pool/blob/master/LICENSE)  \n  \nA lite fast object pool written by Java.  \n\n## 1.2. Requirements  \njdk 1.8+  \nmaven-3.3.1+(support [toolchains](https://maven.apache.org/guides/mini/guide-using-toolchains.html))  \n\n## 1.3. Maven dependency\n\n```xml  \n    \u003cdependency\u003e\n        \u003cgroupId\u003ecn.nextop\u003c/groupId\u003e\n        \u003cartifactId\u003elite-pool\u003c/artifactId\u003e\n        \u003cversion\u003e1.0.0-RC3\u003c/version\u003e\n    \u003c/dependency\u003e\n```\n\n## 1.4. Install from source code  \n\n``` \n    $mvn clean install -Dmaven.test.skip=true --global-toolchains ./toolchains.xml\n```  \n\n# 2. Usage  \n## 2.1. PoolBuilder  \n\n| **Config** | **Default value** | **Details**                                                                              |\n| ---------- | ----------------- | -----------------------------------------------------------------------------------------|\n| minimum    | 0                 | minimum allowed objects in pool                                                          |\n| maximum    | 16                | maximum allowed objects in pool                                                          |\n| tti        | 15 minutes        | time to idle, optional maximum pool objects' idle time, unit ms                          |\n| ttl        | 60 minutes        | time to live, optional maximum pool objects' life time, unit ms                          |\n| tenancy    | 1  minutes        | optional leak detection timeout, unit ms, (**MUST** \u003e= `interval`)                       |\n| timeout    | 8  seconds        | default acquire timeout, unit ms                                                         |\n| interval   | 15 seconds        | default house keeping scheduler's interval, unit ms                                      |\n| local      | true              | use `ThreadAllocator` as L1 cache or not                                                 |\n| verbose    | false             | print log or not                                                                         |\n| fifo       | false             | pool allocation policy, `false` has better performance                                   |\n| allocator  | DefaultAllocator  | pool allocator, can be customized by extending `AbstractAllocator`                       |\n| supplier   |                   | required callback for creating pool objects                                              |\n| consumer   |                   | optional callback for destroying pool objects                                            |\n| validator  |                   | optional callback for validating pool objects                                            |\n| validation | PULSE             | precondition for `validator`, e.g : `new PoolValidation((byte)(PULSE\\|ACQUIRE\\|RELEASE))`|\n  \n\n## 2.2. Standalone usage  \n\n```java  \n    public class YourPoolObject {\n    }\n    \n    Pool\u003cYourPoolObject\u003e pool = new PoolBuilder\u003cYourPoolObject\u003e()\n                    .local(true) // using thread local\n                    .supplier(() -\u003e new YourPoolObject())\n                    .interval(interval)\n                    .minimum(minimum)\n                    .maximum(maximum)\n                    .timeout(timeout)\n                    .ttl(ttl)\n                    .tti(tti)\n                    .verbose(true)\n                    ...\n                    .build(\"object pool\");\n    pool.start();\n    try {\n        for(int i = 0; i \u003c 1000; i++) {\n            YourPoolObject object = null;\n            try {\n                object = pool.acquire();\n                if (object != null) {\n                    // your code goes here. \n                }\n            } finally {\n                if (object != null) pool.release(object);\n            }\n        }\n    } finally {\n        pool.stop();\n    }\n```\n\n## 2.3. Spring integration  \n  \n\n```java  \n    public class YourPoolObject {\n    }\n    \n    package your.package;\n    \n    public class Factory implements Supplier\u003cYourPoolObject\u003e {\n        @Override\n        public YourPoolObject get() {\n            return new YourPoolObject();\n        }\n    }\n\n```\n  \nSpring configuration:  \n  \n```xml  \n\n    \u003cbean id=\"your.object.pool\" class=\"cn.nextop.lite.pool.impl.ObjectPool\" \n        init-method=\"start\" destroy-method=\"stop\"\u003e\n        \n        \u003cconstructor-arg index=\"0\" value=\"your.object.pool\"/\u003e\n        \n        \u003cproperty name=\"config\"\u003e\n            \u003cbean class=\"cn.nextop.lite.pool.PoolConfig\"\u003e\n                \u003cproperty name=\"minimum\" value=\"10\"/\u003e\n                ... \n                \u003cproperty name=\"supplier\"\u003e\n                    \u003cbean class=\"your.package.Factory\"/\u003e\n                \u003c/property\u003e\n            \u003c/bean\u003e\n        \u003c/property\u003e\n    \u003c/bean\u003e\n\n```\n\n# 3. PoolListener\n\n```java  \n    Pool\u003cYourPoolObject\u003e pool = new PoolBuilder\u003cYourPoolObject\u003e()\n                    .local(true) // using thread local\n                    .supplier(() -\u003e new YourPoolObject())\n                    ...\n                    .build(\"object pool\");\n    pool.addListener(event -\u003e {\n        YourPoolObject item = event.getItem();\n        switch (event.getType()) {\n            case ACQUIRE:\n                // your code goes here\n                break;\n            case RELEASE:\n                // your code goes here\n                break;\n            case LEAKAGE:\n                // your code goes here\n                break;\n            default:\n                throw new AssertionError();\n        }\n    });\n    pool.start();\n```\n\n# 4. Write your own PoolAllocator\n\n```java  \n\npublic class YourPoolAllocator\u003cT\u003e extends AbstractAllocator\u003cT\u003e {\n\n    public YourPoolAllocator(Pool\u003cT\u003e pool, String name) {\n        super(pool, name);\n    }\n\n    @Override\n    protected Slot\u003cT\u003e doRelease(T t) {\n        // if uses thread local as L1 cache, thread allocator will try to acquire without delegating to \n        // parent allocator, but always delegate to parent to release. that requires your allocator is \n        // able to remove duplication on release.\n        //\n        // if pool object is invalidated, your allocator should delete it and invoke super.consume(t).\n        //\n        // please refer to DefaultAllocator and AllocationQueue for more details.\n        return null;\n    }\n\n    @Override\n    protected Slot\u003cT\u003e doAcquire(long timeout, TimeUnit unit) {\n        // returns null if timeout or thread is interrupted.\n        // if the acquired object is invalid and do not reach out timeout, do following steps:\n        // step1 : permanently delete it and invoke super.consume(t).\n        // step2 : acquire again until timeout.\n        //\n        // please refer to DefaultAllocator and AllocationQueue for more details.\n        return null;\n    }\n\n    public static class Factory\u003cT\u003e implements PoolAllocatorFactory\u003cT\u003e {\n        @Override public final PoolAllocator\u003cT\u003e create(final Pool\u003cT\u003e v) {\n            String n = v.getName() + \".allocator.your.name\"; return new YourPoolAllocator\u003c\u003e(v, n);\n        }\n    }\n}\n\n```\n  \nRegister `YourPoolAllocator` to Pool  \n  \n```java  \n\nPool\u003cYourPoolObject\u003e pool = new PoolBuilder\u003cYourPoolObject\u003e()\n                    .allocator(new YourPoolAllocator.Factory\u003c\u003e())\n                    ...\n                    .build(\"object pool\");\n```\n \n# 5. JMX\n\nMXBean : `cn.nextop.lite.pool:type=PoolConfig`  \n  \n| **Attribute** | **Modifiable** | **Details**                             |\n|---------------|----------------|-----------------------------------------|\n| Maximum       | Yes            | see [2.1. PoolBuilder](#21-poolbuilder) |\n| Minimum       | Yes            | see [2.1. PoolBuilder](#21-poolbuilder) |\n| Tenancy       | Yes            | see [2.1. PoolBuilder](#21-poolbuilder) |\n| Timeout       | Yes            | see [2.1. PoolBuilder](#21-poolbuilder) |\n| Tti           | Yes            | see [2.1. PoolBuilder](#21-poolbuilder) |\n| Ttl           | Yes            | see [2.1. PoolBuilder](#21-poolbuilder) |\n| Verbose       | Yes            | see [2.1. PoolBuilder](#21-poolbuilder) |\n  \nMXBean : `cn.nextop.lite.pool:type=PoolAllocator`  \n  \n| **Attribute** | **Modifiable** | **Details**                                                              |\n|---------------|----------------|--------------------------------------------------------------------------|\n| EntireCount   | No             | pool's entire object count.                                              |\n| WorkingCount  | No             | pool's working object count, equivalent to `EntireCount - RestingCount`. |\n| RestingCount  | No             | pool's resting object count.                                             |\n| PendingCount  | No             | pool's pending request count.                                            |\n  \n\n# 6. Benchmark\n\nTest env:  \n\n```xml  \n    OS : Windows 7 Home(64bit)\n    CPU: Intel(R) Core(TM) i3-4710 CPU @ 3.70GHz  3.70GHz\n    RAM: 8.00 GB\n    JDK: java version \"1.8.0_151\"\n\n```\n\nTest case:  \n  \nBasic Parameters: 10 minimum, 10 maximum  \n  \n```java  \n    TestObject object = pool.acquire();\n    if (object != null) pool.release(object);\n```\n  \n(unit: ops/ms)  \n  \nParameters: see [BaseTest.java](./src/test/java/cn/nextop/lite/pool/BaseTest.java)  \n  \nBenchmark Classes: see [LitePoolBenchmark.java](./src/test/java/cn/nextop/lite/pool/benchmark/LitePoolBenchmark.java) and [CommonsPool2Benchmark.java](./src/test/java/cn/nextop/lite/pool/benchmark/CommonsPool2Benchmark.java)  \n  \nRun [Benchmark.java](./src/test/java/cn/nextop/lite/pool/benchmark/Benchmark.java)  \n  \nUse `ThreadAllocator` as L1 cache result:  \n  \n\u003cimg src=\"./benchmark/benchmark-local-true.png\" width=\"80%\" height=\"80%\"\u003e  \n  \nUnused `ThreadAllocator` as L1 cache result:  \n  \n\u003cimg src=\"./benchmark/benchmark-local-false.png\" width=\"80%\" height=\"80%\"\u003e  \n  \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnextopcn%2Flite-pool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnextopcn%2Flite-pool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnextopcn%2Flite-pool/lists"}