{"id":20316466,"url":"https://github.com/javinator9889/threadingtools","last_synced_at":"2026-04-29T23:33:22.584Z","repository":{"id":114247219,"uuid":"157689831","full_name":"Javinator9889/ThreadingTools","owner":"Javinator9889","description":"Java useful tools for managing threads like a master ⚡👊🛠","archived":false,"fork":false,"pushed_at":"2018-11-21T08:22:55.000Z","size":524,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-04T20:56:32.407Z","etag":null,"topics":["android","gradle","java","java-10","java-11","java-8","java-9","javadoc","lambda","library","listener","master","notification","powerful","thread","tool"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Javinator9889.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-15T09:59:47.000Z","updated_at":"2018-11-20T15:59:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"74da56a1-f8f4-4013-bffc-f293a724ac0b","html_url":"https://github.com/Javinator9889/ThreadingTools","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Javinator9889/ThreadingTools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Javinator9889%2FThreadingTools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Javinator9889%2FThreadingTools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Javinator9889%2FThreadingTools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Javinator9889%2FThreadingTools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Javinator9889","download_url":"https://codeload.github.com/Javinator9889/ThreadingTools/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Javinator9889%2FThreadingTools/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32448400,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"ssl_error","status_checked_at":"2026-04-29T22:10:49.234Z","response_time":110,"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":["android","gradle","java","java-10","java-11","java-8","java-9","javadoc","lambda","library","listener","master","notification","powerful","thread","tool"],"created_at":"2024-11-14T18:26:16.809Z","updated_at":"2026-04-29T23:33:22.567Z","avatar_url":"https://github.com/Javinator9889.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ThreadingTools\nJava useful tools for managing threads like a master ⚡👊🛠\n\n\n## 1. Introduction and purposes\n\n### `ThreadsPooling`\n*ThreadsPooling* provides a \u003cb\u003efast, easy\u003c/b\u003e access to a pool of threads that concurrently\nmust be running, with upper limits.\n\nIt accepts **all types of** `Runnable` classes:\n\n+ `Thread`.\n+ `NotifyingThread`.\n+ Any class that implements `Runnable`.\n\n*ThreadsPooling* aims to be **as helpful as possible** for the developer: with some simple \nmethods, anyone can create a new *ThreadsPooling* object with all the values set-up to their \ndefaults:\n\n+ **Concurrent running process**: its default value is `4`.\n+ **Maximum running process**: its default value is `8`.\n+ **Default keep alive time**: its default is `100 ms`.\n+ **Default queue capacity**: its default is `100` items.\n\nFor more information, please read the \n**[official documentation](https://javinator9889.github.io/ThreadingTools/com/github/javinator9889/threading/pools/ThreadsPooling.html)**.\n\n### `NotifyingThread`\n\n*NotifyingThread* provides an specialised class on **threading** that adds more options to the \ncurrently available ones:\n\n+ **Notifying**: sometimes, we want to get notified when a `Thread` completes its execution, but \nactually the most we can do is just call `join()` and wait until its completion, making us unable\n to **do other works**. \u003cbr /\u003e\n `NotifyingThread` provides a **fast, powerful** class for getting notified when, the *threads we\n  want*, finish. The only requirement is to **subscribe** our class to the *listener* classes, \n  just by implementing `OnThreadCompletedListener`.\n  \n+ **Fast development**: is very useful to create **nested classes** inside a thread by \ndeclaring:\u003cbr /\u003e\n    ```java\n    new Thread(new Runnable() {\n        // ALL THE CODE TO BE EXECUTED\n    }).start();\n    ```\n    Using the **powerful** lambda expressions, doing this with the code is not more necessary. \n    For example:\n    ```java\n    public class MyClass implements OnThreadCompletedLisener {  \n      private int myField;\n      \n      /* --- CONSTRUCTORS,ETC. --- */\n    \n      public void heavyOperationThatUsesLotsOfResources() {\n          // The big operation - imagine that uses myField value\n          // This operation also takes about 5 minutes to complete,\n          // so we do not want to wait all that time.  \n      }\n    \n      public void caller() {\n          NotifyingThread thread = new NotifyingThread(this);\n          // \"this\" refers itself for the \"OnCompletedListener\"\n          thread.setExecutable(this::heavyOperationThatUsesLotsOfResources);\n          // by using that expression, we do not need to write again\n          // the hole function.\n          thread.start();\n      }\n    \n      public void onThreadCompletedListener(final Thread thread, Throwable exception) {\n          // Handle thread finish\n          if (exception != null)\n              System.out.println(\"Thread \" + thread.getName() + \" finished!\");\n          else \n              System.err.println(\"Thread \" + thread.getName() + \" finished with an exception\");\n      }\n    }\n    ```\n    As you can see, we declared and used the **function inside our class** only with one line, by\n     using a lambda expression.\n     \n+ **Adaptive**: by using the `ArgumentParser` and the overloaded methods of `setExecutable`, \n`NotfyingThread` adapts to each function you need to use at every moment.\n\nFor more information, please read the \n**[official documentation](https://javinator9889.github.io/ThreadingTools/com/github/javinator9889/threading/threads/notifyingthread/package-summary.html)**.\n\n### `ArgumentParser`\n\n`ArgumentParser` provides a \u003cb\u003efully compatible\u003c/b\u003e class with \u003ci\u003eplenty of objects\u003c/i\u003e. It\nis designed for using it as an \u003cb\u003eaccess platform\u003c/b\u003e to methods' arguments and params, taking\nadvantage of *lambda expressions* of Java 8 and above.\n\nIt is not \u003cb\u003ethread safe\u003c/b\u003e as all the operations are not done \u003ci\u003eatomically\u003c/i\u003e, so there is no\nguarantee that all the data stored at `HashMap` is saved in the order expected and with the\nexpected values if appending from multiple threads at the same time.\n\nIt is based on **ContentValues**, used in Android, with some *customizations* and new tools.\n\nFor more information, please read the \n**[official documentation](https://javinator9889.github.io/ThreadingTools/com/github/javinator9889/utils/ArgumentParser.html)**.\n\n\n## 2. Installation\n\nFor using this library at **any Java application you are using**, you can just *[download from \n\"Releases\"](https://github.com/Javinator9889/ThreadingTools/releases)* or use one of the \nfollowing methods:\n\n### Maven\n*First add JCenter to your app*:\n```xml\n\u003crepositories\u003e\n    \u003crepository\u003e\n      \u003cid\u003ejcenter\u003c/id\u003e\n      \u003curl\u003ehttps://jcenter.bintray.com/\u003c/url\u003e\n    \u003c/repository\u003e\n\u003c/repositories\u003e\n```\n\nThen, you can just include the lib:\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.github.javinator9889\u003c/groupId\u003e\n  \u003cartifactId\u003ethreadingtools\u003c/artifactId\u003e\n  \u003cversion\u003e1.0\u003c/version\u003e\n  \u003ctype\u003epom\u003c/type\u003e\n\u003c/dependency\u003e\n```\n\n### Gradle\n*First, add JCenter to your app*:\n```groovy\nrepositories {\n    jcenter()\n    // Other repositories you have\n}\n```\n\nThen, you can just include the lib:\n```groovy\nimplementation 'com.github.javinator9889:threadingtools:1.0'\n```\n\n### Ivy\n*First, add JCenter to your Ivy settings*:\n```xml\n\u003civysettings\u003e\n    \u003cresolvers\u003e\n        \u003cibiblio name=\"bintray\"\n                 m2compatible=\"true\"\n                 root=\"http://dl.bintray.com/content/example/external-deps\"/\u003e\n    \u003c/resolvers\u003e\n\u003c/ivysettings\u003e\n```\n\nThen, you can just include the lib:\n```xml\n\u003cdependency org='com.github.javinator9889' name='threadingtools' rev='1.0'\u003e\n  \u003cartifact name='threadingtools' ext='pom' \u003e\u003c/artifact\u003e\n\u003c/dependency\u003e\n```\n\nYou must have to **include JCenter()** in order to make it work.\n\n## 3. Usage\n\nAfter [successfully included the library in your project](#2-installation), you must do the following for using this class:\n+ Generate a new `ThreadsPooling` if you are going to use them.\n+ Setup the `NotifyingThreads`, and include them inside the `ThreadsPooling`.\n+ Call `ThreadsPooling.start()` method for start executing the threads.\n\nYou can see some examples at the [examples folder](https://github.com/Javinator9889/ThreadingTools/tree/master/examples), \nin which all those process and lambda usage are specified.\n\nIf you need more information, [read the docs](https://javinator9889.github.io/ThreadingTools/) in\n which you will find **every method detailed and explained**.\n \n\n## 4. Contributing\n\nIf you find any error or you want to **add a new feature**, you can perfectly:\n1. Open a **[new issue](https://github.com/Javinator9889/ThreadingTools/issues)** completing\n the *issue template* so it will be easier to solve it.\n \n2. Create a new **[pull request](https://github.com/Javinator9889/ThreadingTools/pulls)** \nwith the changes you have made to the project, and waiting my approval for merging them.\n\n3. Give me a **star** ⚡⭐ if you found this library useful 😄\n \n## 5. License\n \n     Copyright © 2018 - present | Javinator9889\n \n     This program is free software: you can redistribute it and/or modify\n     it under the terms of the GNU General Public License as published by\n     the Free Software Foundation, either version 3 of the License, or\n     (at your option) any later version.\n \n     This program is distributed in the hope that it will be useful,\n     but WITHOUT ANY WARRANTY; without even the implied warranty of\n     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n     GNU General Public License for more details.\n \n     You should have received a copy of the GNU General Public License\n     along with this program.  If not, see https://www.gnu.org/licenses/.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavinator9889%2Fthreadingtools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjavinator9889%2Fthreadingtools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavinator9889%2Fthreadingtools/lists"}