

Show HN: A task-based concurrency framework for Java - gregw134
https://github.com/Gregw135/Simple-Java-Concurrency-Framework

======
switch33
Yay, someone who also realizes that concurrency is somehow easier in assembly.
Last time I heard that from anyone else was from Erik McClure.

It's sad it's taken this long for some things to be so simple in Java.

Also up-voted this, because it's good programming, something that comes around
only every once and a while.

~~~
gregw134
Thanks switch. I agree, I have no idea why everything in Java has to be so
stupidly complex. It shouldn't take a month to learn how to make a safe
concurrent program.

Does the design here seem to make sense to you? I haven't had anybody review
this design yet, so I'm not entirely comfortable with it. Do you think the
whole premise makes sense, where you let users return Status.RetryLater and
send their Task to the back of a queue? I intended it as an easy way to allow
blocking without occupying a thread, but I have a sneaking suspicion that
there might be something wrong with it...concurrency is confusing after all...

~~~
switch33
I am not the one to ask about this. I simply don't know enough to verify that
the way you are doing this is right.

Given, I did take a quick look at it and it seems like an ok way of going
about it. The factory implementation and using queues does make sense but I
think it is a rather old way of handling concurrency and I am unfamiliar of
any newer ways of doing it.

From wikipedia, Java usually uses Shared Memory for communication between
threads. So as long as you are handling the application with some form of
locking (e.g., mutexes, semaphores, or monitors) to coordinate between threads
it should work. Rosetta code some information on Java concurrency:
[http://rosettacode.org/wiki/Concurrent_computing#Java](http://rosettacode.org/wiki/Concurrent_computing#Java)
And with using a mutex:
[http://rosettacode.org/wiki/Mutex#Java](http://rosettacode.org/wiki/Mutex#Java)

I'd say look at other implementations for concurrency in another language and
do a comparison if you can. It sounds like you are doing some of it right.

You may get a better more thought out response from
[http://lobste.rs/](http://lobste.rs/) if you are a member there. If not ask
on Hacker News to get an invite for it. They are always posting some fairly
in-depth programming discussions and you might get more of a response there.

Also try reddit r/programming they can be harsh but helpful at times.

I am not much of a fan of java. I'm much more of a fan of whatever fits the
job best but in most cases that is C/C++. It doesn't suffer from "enterprise
everything with long ass names" like Java or C#. C has some decent
threading/concurrency libraries just because when people do performance work
on computers they often go for C because it is very close to bare-metal.

