BlogicBlog: View from the trenches

The blog about Java and XML with focus on troubleshooting issues and tools.

Tuesday, August 16, 2005

Easier way to collect thread dumps

Permanent article link

When I worked at BEA support, we troubleshooted a lot of issues using the thread dumps. There were a couple of problems with them:
  • On Solaris/Linux/HP-UP, the thread dumps had to be extracted from the stdout files, which in some cases did not exist (never redirected) and in others were not rotated on restart and therefore had several months of logs (GBs). Either way finding the thread dumps was difficult.
  • Windows users often just had stdout going to the console and, when the thread dumps were screen-scraped, they got broken up in all sorts of strange locations making it harder to do any automated processing or even a decent pattern search.
  • When more than one thread dump was required (90% of the cases), it was hard to figure out how often the thread dumps were taken as they did not include a timestamp. At least SUN JVM did not. JRockit and IBM, both had it.
Therefore, I am glad to see that it is becoming easier to get good thread dumps. At least for JRockit with the jrcmd command. In fact, the command looks useful for a number of things.

Unfortunately, it is still somewhat hard to do the same with SUN's JVM. They have the jstack command, but it is still not available for Windows.

Of course, with dTrace, thread dumps might become obsolete, but yet again this is only a Solaris 10 option, though there are some rumours of dTrace for BSD or maybe even Debian.

In a short term though, if you find yourself in need of some serious thread dump taking, do take a look at JRockit. It is free after all. And it does have other cool troubleshooting tools.

BlogicBlogger Over and Out

Sunday, August 14, 2005

Book review: 'Blog' by Hugh Hewitt

Permanent article link

I blog. Obviously! But I felt that an influential blogger like Hugh Hewitt might give a good overview and write a book worth reading. Boy, was I mistaken.

This book is squarely targeted at non-technical, right-wing, religious Americans who don't mind being sneered at. Anybody else should try to avoid it.

For that Anybody else group, here is couple of reasons from the book itself (emphasis mine).
  • An audience test that really should have been on the book's jacket and not on the page 88 of the book:
    Most of America knows that elite journalism is staffed by people who are overwhelmingly way-left-of-center in their politics. If you don't believe that America believes that, or you want to argue over what 'way-left-of-center' means, you have purchased the wrong book. You are still living in the land of the lost and don't want to move, so go buy Al Franken's or Michael Moore's latest and miss the revolution.

  • Hugh seems to think that contempt is a good thing to demonstrate to prove your point:
    Barbra Streisand is a blogger. A not-very-bright one, but a blogger nonetheless. (p 128)

  • I am also not so sure Hugh was the right person to advise on how to setup a blog. He freely admits to not knowing the technology, but the following quote shows that maybe the editor should have insisted harder on a technophilic co-writer.
    I am still unsure what an RSS feed is and have trouble making the permalinks work - but it does not matter!
    RSS is so important in having a blog read and indexed that sacrificing it for whatever easy to start a blog point Hugh had was in my mind a terrible choice. He has an RSS feed on his own website - four types actually - so he has denied others what might be contributing to his own success.

  • Nearly all of the examples are given based on political or religious blogs. Are the technical blogs not worth a mention? Or is the technical community is just not a target for the book because they have already figured all of this out? Either way, mentioning a blogging CEO like Jonathan Schwartz would have carried Hugh's point much further than the argument in the book did. In fact the only real mention of the technological company is Technorati, which Hugh is plugging quite often.

  • Even the practical advice does not seem to ring a bell for me. For example:
    So how to go about making friends in the blogosphere? Here are some specific steps.

    First, acquaint yourself with the form, and having done so, decide who genuinely does a good job, who meets your information needs. Then tell them. Via e-mail. Repeatedly.


    The word SPAM comes to mind. I am not sure why. Maybe it is the Repeatedly bit that seems to imply rejection at first attempt.

  • The section on what to do when one is convinced to start blogging is interesting, but unfortunately, it is barely 20 pages long. Couple of good articles would have done it better.

  • Finally, there seems to be no mention of the long tail market which allows for so many people to blog about interesting things that are not politics or religion.


Those were the reasons that really made me to write this review. People with stronger political views and sharper tongues actually pick on different points.

Still if I haven't convinced you, maybe the book is for you. It is currently available at Amazon at 60% discount ($8 down from $20). This is quite telling all by itself. After the Amazon takes its own 20% cut - which is another $4 - there is not much margin there for the author to make any money of the book. To me that means that the real purpose of the book was to further increase Hugh's fame rather than to really educate the audience. Caveat emptor!

BlogicBlogger Over and Out

Monday, August 01, 2005

Re: More Readable Classpaths for Ant Builds

Permanent article link

Lance Hankins got annoyed with having to eyeball ant's output of the long classpaths and wrote a task to do the classpath output in a slightly more readable form.

Neat, but perhaps there is a more generic way to do it. After all, not only ant produces these long semi-column separated monstrosities.

So, I want to show how I do it with Vim (Why Vim...).

Let's use Lance's output as given.

  1. Copy and paste it into Vim.
  2. Notice that it is broken into multiple (23) lines. While he probably did it for a better web presentation, this also happens when somebody screen scrapes the classpath from the DOS window.
  3. Let's combine all the lines back into one long one: :%j!.
    This command means:

    • in the command-line mode (:),
    • for the whole buffer (%)
    • join lines (j)
    • without inserting or deleting any spaces on the join (!)

  4. Now, let's split them on the semicolon: :s/;/^M/g.
    In here, we are

    • in the command mode again (:),
    • working with the current line (no range indicated)
    • doing a substitution (s/FROM/TO/)
    • from semicolon (/;/)
    • to a line break (^M, produced -at least on windows- with CTRL-Q CTRL-M key sequence),
    • and repeating this substitution for the whole line (s/FROM/TO/g)

  5. Ok, we are done in less than 20 keystrokes including cut and paste and carriage returns!
  6. Let's see what else we can do. How about sorting and deduping the entries? (after cleaning up the first line to remove the [echo....] bit)
  7. :%!sort -u. This will require Cygwin to be first on the path in the Windows environments.
  8. How about highlighting all the sprint jars in one color and all hibernate jars in another?
  9. :1OTF spring and :2OTF hibernate. This requires OTF Vim plugin.
  10. As an added benefit, the command above immediately highlight spring's jar for hibernate as it is the only line with two colors on it. Could be useful to keep in mind.


I could go on for a while, but hopefully this will be a more useful and generic way to deal with long classpaths rather than having to write an ant task. KISS, DRY, etc.

BlogicBlogger Over and Out