{"id":31029957,"url":"https://github.com/cowwoc/token-bucket","last_synced_at":"2025-09-13T22:57:18.792Z","repository":{"id":42697096,"uuid":"256061065","full_name":"cowwoc/token-bucket","owner":"cowwoc","description":"A Java implementation of the Token Bucket algorithm","archived":false,"fork":false,"pushed_at":"2023-05-01T21:18:15.000Z","size":657,"stargazers_count":5,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-28T09:50:02.314Z","etag":null,"topics":["java","limiter","throttling","token-bucket"],"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/cowwoc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"cowwoc"}},"created_at":"2020-04-15T23:35:52.000Z","updated_at":"2024-09-05T14:06:36.000Z","dependencies_parsed_at":"2023-01-30T04:31:15.702Z","dependency_job_id":null,"html_url":"https://github.com/cowwoc/token-bucket","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/cowwoc/token-bucket","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cowwoc%2Ftoken-bucket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cowwoc%2Ftoken-bucket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cowwoc%2Ftoken-bucket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cowwoc%2Ftoken-bucket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cowwoc","download_url":"https://codeload.github.com/cowwoc/token-bucket/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cowwoc%2Ftoken-bucket/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275038262,"owners_count":25394640,"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","status":"online","status_checked_at":"2025-09-13T02:00:10.085Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["java","limiter","throttling","token-bucket"],"created_at":"2025-09-13T22:57:09.093Z","updated_at":"2025-09-13T22:57:18.780Z","avatar_url":"https://github.com/cowwoc.png","language":"Java","funding_links":["https://github.com/sponsors/cowwoc"],"categories":[],"sub_categories":[],"readme":"[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.cowwoc.token-bucket/token-bucket/badge.svg)](https://search.maven.org/search?q=g:com.github.cowwoc.token-bucket)\n[![build-status](../../workflows/Build/badge.svg)](../../actions?query=workflow%3ABuild)\n\n# \u003cimg src=\"wiki/bucket.svg\" width=64 height=64 alt=\"checklist\"\u003e Token-Bucket\n\n[![API](https://img.shields.io/badge/api_docs-5B45D5.svg)](https://cowwoc.github.io/token-bucket/6.0/docs/api/)\n[![Changelog](https://img.shields.io/badge/changelog-A345D5.svg)](wiki/Changelog.md)\n\nA Java implementation of the [Token Bucket algorithm](https://en.wikipedia.org/wiki/Token_bucket).\n\n# Download\n\nYou can download this library from https://search.maven.org/search?q=g:com.github.cowwoc.token-bucket or using\nthe following Maven dependency:\n\n```\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.github.cowwoc.token-bucket\u003c/groupId\u003e\n  \u003cartifactId\u003etoken-bucket\u003c/artifactId\u003e\n  \u003cversion\u003e6.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n# Usage\n\n```\n// Allow 60 requests per minute, with a maximum burst of 120 requests.\nBucket server1 = Bucket.builder().\n  addLimit(limit -\u003e limit.\n    tokensPerPeriod(60).\n    period(Duration.ofMinute(1)).\n    maxTokens(120).\n    build()).\n  build();\n\n// Allow 60 requests per minute, with a maximum burst of 10 requests per second.\nBucket server2 = Bucket.builder().\n  addLimit(limit -\u003e limit.\n    tokensPerPeriod(60).\n    period(Duration.ofMinute(1)).\n    build()).\n  addLimit(limit -\u003e limit.\n    tokensPerPeriod(10).\n    period(Duration.ofSecond(1)).\n    build()).\n  build();\n\n// Choose a server and send requests\nBucket bucket = server1;\n\nwhile (true)\n{\n  bucket.consume();\n  client.pollServer();\n}\n```\n\n# License\n\n* Code licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0\n* Icons from www.svgrepo.com licensed under the CC0 License","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcowwoc%2Ftoken-bucket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcowwoc%2Ftoken-bucket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcowwoc%2Ftoken-bucket/lists"}