• Spencer (unregistered) in reply to Over-anal-yzed
    Over-anal-yzed:
    QJo:
    Masaaki:
    Masaaki:
    Buttbuttin's Creed.

    Dammit, forgot to hit the Quote button.

    This was in reply to

    "It's all fun and games until someone gets buttbuttinated"

    This is turning into a bit of a compebreastion.

    Oh yeah? Real programmers use butterflies!

    Things are going to start getting ricockulous soon

  • Norman Diamond (unregistered) in reply to QJo
    QJo:
    Masaaki:
    Masaaki:
    Buttbuttin's Creed.
    This was in reply to

    "It's all fun and games until someone gets buttbuttinated

    This is turning into a bit of a compebreastion.
    You mean here on thedailywhatthesexualdiscourse.com?

  • Paul M (unregistered)

    poolSize not marked volatile.

  • (cs) in reply to Paul M

    Why would this surprise anyone? Everyone knows that they produce excrement; it's even in their name.

  • Rafa (unregistered) in reply to Severity One
    Severity One:
    Doctor_of_Ineptitude:
    And personally, sometimes, an array of function pointers is way better than a lengthy switch case.
    So that's why there are lambda expressions in Java 8. Not that they're particularly easy to understand, or maybe I'm just too old.

    C# has delegates, C++ has lambdas and function objects (that use type erasure and sometimes the heap under the hood) and all three languaues can do the same task using virtual (vtable) method dispatching.

    In which way is branching through an array of pointers better than plain virtual method dispatching or a plain good old jump table automatically generated for you by a good compiler from the switch statement?

    It depends on the context and the overheads one wants to assume. I suppose that the array of funcptrs comment came from an embedded developer.

    But even in an embedded environment an array of pointers is not always superior to a switch statement, even more when the switch case values are sequence ordered. In this last case a good compiler will generate the jump table for you and just jump to another code location without needing a function call.

  • somebloke (unregistered) in reply to Nagesh
    Nagesh:
    Over-anal-yzed:
    Oh yeah? Real programmers use butterflies!
    I never use any butterfly in programming.
    *not sure if got the point* http://xkcd.com/378/
  • (cs) in reply to Pista
    Pista:
    I don't see the point trying something if you're not catching anything...
    To determine if you should be using an empty catch block for your try statement run in past the following: A. Will by try block succeed 100% of the time. 2. Is it my job to fix it upstream so it does succeed 100% of the time. C. Do I feel like implementing Actual error checking.

    If you answered "No" to any of these questions: Congradulations, your code is a candidate for an empty catch block.

    Catch and Release Error checking!

  • DGS (unregistered) in reply to no laughing matter
    no laughing matter:
    frz:
    Exceptions were not caught, but sent to the console instead of the log4j log file
    This does not happen in the code posted. (I'm assuming that's a slf4j LogFactory)
    Actually it does happen in the runTask-method:
    private void runTask(Runnable task) {
    ...
    	try {
    		task.run();
    		ran = true;
    		++completedTaskCount;
    	} catch (RuntimeException ex) {
    		logger.error("Error occured in afterExecute method.", ex);
    		throw ex;
    	}
    ...
    }
    

    I still don't see any System.out.print() or e.printStacktrace() call in this codeblock. Only a logger call, which depends on log4j setting. It can send the message to logfile, console or both.

Leave a comment on “The Thread Mismanager”

Log In or post as a guest

Replying to comment #:

« Return to Article