Inter Thread Task Transfer

Most of my projects (infact all of them) are only 80% complete and have not published them anywhere. Hence finally thought that it is high time now to complete Unfinished Business :). The next few posts will only be explaining th different libraries I had made for fun but later realized that they actually are useful 😛


First in the sequence is a small library I had made probably 6-7 months ago; which I call it as Inter Thread Task Transfer. Their respective source codes are available at github under MIT license.

I first built it inspired from Looper & Handler in Android. But then later realized due to the wrong design pattern chosen to construct it, it is not scalable at all. Hence only provides basic features. Frustrated with design I choose a new Design Pattern (which till now is working fine 🙂 )  and worked on it to construct the same thing. But the code can be extended to several other features and infact is pretty useful in general life.
In nutshell Every thread can create a handle which is to be merged with Looper. Using this handle another thread can send the respective Runnable’s and Callable’s to the owner thread. Also the API provides functionality to get the returned values. Hence threads can share their load among a group.

Small functionality which can be added is that currently threads can only provide but not take. That can be very easily extended.

PS: Some problem with the github account, you can download the previous code from here and with the better design here.