{"id":25073791,"url":"https://github.com/chris2018998/beeop","last_synced_at":"2025-03-31T19:16:08.278Z","repository":{"id":110397841,"uuid":"315687790","full_name":"Chris2018998/BeeOP","owner":"Chris2018998","description":"A small java object pool","archived":false,"fork":false,"pushed_at":"2024-03-19T09:18:58.000Z","size":6662,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-06T23:33:47.922Z","etag":null,"topics":["beeop","high-performance","java","object-pooling"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Chris2018998.png","metadata":{"files":{"readme":"README-ZH.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-11-24T16:19:33.000Z","updated_at":"2022-08-18T10:01:30.000Z","dependencies_parsed_at":"2024-03-19T09:57:51.123Z","dependency_job_id":null,"html_url":"https://github.com/Chris2018998/BeeOP","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chris2018998%2FBeeOP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chris2018998%2FBeeOP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chris2018998%2FBeeOP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chris2018998%2FBeeOP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Chris2018998","download_url":"https://codeload.github.com/Chris2018998/BeeOP/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246523845,"owners_count":20791444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["beeop","high-performance","java","object-pooling"],"created_at":"2025-02-06T23:33:56.003Z","updated_at":"2025-03-31T19:16:08.259Z","avatar_url":"https://github.com/Chris2018998.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://github.com/Chris2018998/BeeOP/blob/master/README.md\"\u003eEnglish\u003c/a\u003e|\u003ca href=\"https://github.com/Chris2018998/BeeOP/blob/master/README-ZH.md\"\u003e中文\u003c/a\u003e\n![图片](https://user-images.githubusercontent.com/32663325/154847136-10e241ae-af4c-478a-a608-aaa685e0464b.png)\n\n\u003cp align=\"left\"\u003e\n \u003ca\u003e\u003cimg src=\"https://img.shields.io/badge/JDK-1.7+-green.svg\"\u003e\u003c/a\u003e\n \u003ca\u003e\u003cimg src=\"https://img.shields.io/badge/License-LGPL%202.1-blue.svg\"\u003e\u003c/a\u003e\n \u003ca\u003e\u003cimg src=\"https://maven-badges.herokuapp.com/maven-central/com.github.chris2018998/beeop/badge.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e \n\n## :coffee: 简介 \n\nBeeOP：一款小型Java对象池组件 \n\n## :arrow_down: 下载 \n\nJava7或更高\n```xml\n\u003cdependency\u003e\n   \u003cgroupId\u003ecom.github.chris2018998\u003c/groupId\u003e\n   \u003cartifactId\u003ebeeop\u003c/artifactId\u003e\n   \u003cversion\u003e1.2.8\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## 性能测试\n100万次借用/归还(1000线程 x1000次),获取时间分布,平均时间\n|  对象池名    | commons-pool2-2.9.0 | BeeOP0.3_Fair      | BeeOP0.3_Compete  |\n| ----------- |----------------     | -------------------| -------------      |  \n| 平均时间     | 2.677456            | 0.000347           |  0.000187          |\n\n测试配置：PC:I5-4210M(2.6赫兹，双核4线程),12G内存 Java:JAVA8_64 Pool:初始10,最大10\n\n日志文件：[https://github.com/Chris2018998/BeeOP/blob/main/doc/temp/ObjectPool.log](https://github.com/Chris2018998/BeeOP/blob/main/doc/temp/ObjectPool.log)\n\n源码位置：[https://github.com/Chris2018998/BeeOP/blob/main/doc/temp/BeeOP_Test.rar](https://github.com/Chris2018998/BeeOP/blob/main/doc/temp/BeeOP_Test.rar)\n\n## 范例\n```java\npublic interface Book {\n    public String getName();\n    public long getNumber();\n}\npublic class JavaBook implements Book{\n    private String name;\n    private long number;\n    public JavaBook() {\n        this(\"Java核心技术·卷2\", System.currentTimeMillis());\n    }\n    public JavaBook(String name, long number) {\n        this.name = name;\n        this.number = number;\n    }\n    public String getName() {\n        return name;\n    }\n    public long getNumber() {\n        return number;\n    }\n    public String toString() {\n        return name;\n    }\n}\n```\n \n```java\npublic class JavaBookFactory implements RawObjectFactory {\n    public Object create() throws ObjectException {\n        return new JavaBook(\"Java核心技术·卷1\", System.currentTimeMillis());\n    }\n    public void setDefault(Object obj) throws ObjectException {\n    }\n    public void reset(Object obj) throws ObjectException {\n    }\n    public void destroy(Object obj) {\n    }\n    public boolean isValid(Object obj, int timeout) {\n        return true;\n    }\n}\n```\n \n```java\n public class TestBookPool{\n   public static void main(String[]){\n       BeeObjectSourceConfig config = new BeeObjectSourceConfig();\n       config.setObjectFactoryClass(JavaBookFactory.class);\n       BeeObjectSource obs = new BeeObjectSource(config);\n       \n       BeeObjectHandle handle = null;\n       try {\n            handle = obs.getObject();\n            Object v=handle.call(\"getName\");\n            System.out.println(\"Book name:\"+v);\n        } catch (BeeObjectException e) {\n        } finally {\n            if (handle != null)\n                handle.close();\n        }\n     }\n }\n```\n\n## 功能支持\n\n1：对象借用超时\n\n2：对象借用支持公平与竞争模式\n\n3：支持对象安全关闭\n\n4：断网对象池自动恢复\n\n5：闲置超时和持有超时处理\n\n6：若对象发生异常，池自动增补\n\n7：对象回收时重置\n\n8：对象池重置\n\n9：支持JMX\n\n## 配置项说明\n\n|             配置项      |   描述                          |   备注                                                      |\n| ---------------------  | ----------------------------    | -----------------------------------------------------------|\n| poolName\t             |池名                              |如果未赋值则会自动产生一个                                      |\n| fairMode               |是否公平模式                       |默认false,竞争模式                                            |\n| initialSize            |池初始创建对象数                   | 默认为0                                                      |\n| maxActive              |池最大创建对象数                   | 默认为10个                                                   | \n| borrowSemaphoreSize    |对象借线程最大并行数                |默认取最大对象数/2与cpu核心数的最小值                            |\n| maxWait                |对象借用等待最大时间(毫秒)           |默认8秒，对象请求最大等待时间                                   |\n| idleTimeout            |对象闲置最大时间(毫秒)              |默认3分钟，超时会被清理                                         |  \n| holdTimeout            |对象被持有不用最大时间(毫秒)         |默认5分钟，超时会被清理                                         |  \n| forceCloseObject       |是否需要暴力关闭对象                |池关闭或重置，使用，默认false;true:直接关闭使用中对象，false:等待处于使用中归还后再关闭|\n| waitTimeToClearPool    |延迟清理的时候时间（秒）             |默认3秒，非暴力清理池下，还存在使用中的对象，延迟等待时间再清理     |      \n| idleCheckTimeInterval  |对象闲置扫描线程间隔时间(毫秒)       |默认5分钟                                                   |\n| objectFactoryClassName |自定义的对象工厂类名                |默认为空                                                    |\n| enableJmx              |JMX监控支持开关                    |默认false                                                  |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchris2018998%2Fbeeop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchris2018998%2Fbeeop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchris2018998%2Fbeeop/lists"}