16 January 2010

Deliver Polished Presentations Steve Jobs Style - Presentation Tips - Lifehacker

Maven Reactor Plugin Examples

Turns out you can be a lot more selective about which modules are built when you run a Maven ractor build.

From Maven Reactor Plugin - Examples
Consider an ordinary multi-module reactor build:

|-- pom.xml
|-- fooUI
| `-- pom.xml
|-- barBusinessLogic
| `-- pom.xml
`-- bazDataAccess
`-- pom.xml

Suppose project "fooUI" depends on project "barBusinessLogic", which depends on project "bazDataAccess".
fooUI --> barBusinessLogic --> bazDataAccess

mvn reactor:resume -Dfrom=barBusinessLogic

Suppose you're working on your code and you attempt to build your code
with mvn install from my-root-project, and suppose you get a test
failure in barBusinessLogic. You make additional changes to
barBusinessLogic without changing bazDataAccess; you know that
bazDataAccess is fine, so there's no need to rebuild/test it.  That will skip over bazDataAccess and pick up the build where you left off in barBusinessLogic. If barBusinessLogic succeeds, it will go on to build fooUI.

mvn reactor:make -Dmake.folders=barBusinessLogic

reactor:make will examine barBusinessLogic and walk down its dependency tree, finding all of the projects that it needs to build. In this case, it will automatically build bazDataAccess and then barBusinessLogic, without building fooUI.

mvn reactor:make-dependents -Dmake.folders=barBusinessLogic

reactor:make-dependents will examine all of the projects in your
reactor to find projects that depend on barBusinessLogic, and
automatically build those and nothing else. In this case, it will
automatically build barBusinessLogic and then fooUI.  Suppose you've made a change to barBusinessLogic; you want to make sure
you didn't break any of the projects that depend on you. (In this case,
you want to make sure that you didn't break fooUI, but in a more
complex reactor that might not be so obvious.) You also want to avoid
rebuilding/testing projects that you know you haven't changed. In this
case, you want to avoid building bazDataAccess.

mvn reactor:make-scm-changes

reactor:make-scm-changes determines which files have changed using your SCM (Source Configuration Management) tool, e.g. Subversion, Perforce, Git, etc. To use it, you'll need to configure an SCM connection in your root project POM file:

mvn reactor:make -Dmake.folders=barBusinesslogic -Dmake.printOnly

All of the reactor plugin goals take in an argument -Dmake.printOnly
that you can use to see what the goal would have done without actually
doing it. For example:

Running a different goal/lifecycle ("test", "package", "eclipse:eclipse", "clean", etc.)

By default, all of the reactor plugin goals will run mvn install on the appropriate projects. That's a pretty reasonable default, but sometimes you want to run a different command on a bunch of projects. All of the reactor plugin goals will accept a -Dmake.goals argument that will let you run other goals instead. You can separate multiple goals with commas:

mvn reactor:make -Dmake.folders=barBusinessLogic -Dmake.goals=eclipse:eclipse
mvn reactor:make-dependents -Dmake.folders=barBusinessLogic -Dmake.goals=package,clean
mvn reactor:resume -Dmake.folders=barBusinessLogic -Dmake.goals=test
mvn reactor:resume -Dmake.folders=barBusinessLogic -Dmake.goals=install,-DskipTests

In other words, the "goals" are just extra command-line parameters passed to the spawned Maven; they don't necessarily have to be "goals."

mvn reactor:make -Dmake.folders=fooUI -Dfrom=barBusinessLogic

When you use reactor:make, you run a subset of projects, but that doesn't mean stuff won't fail halfway through the build. You can resume a reactor:make build from the project that stopped the build by passing -Dfrom to the reactor:make goal.  The -Dfrom argument also works with reactor:make-dependents and reactor:make-scm-changes.

Nested directories

Let's consider a more complex project:

|-- pom.xml
|-- fooUI
| `-- pom.xml
|-- barBusinessLogic
| `-- pom.xml
|-- quz
| |-- pom.xml
| |-- quzAdditionalLogic
| | `-- pom.xml
| `-- quzUI
| `-- pom.xml
`-- bazDataAccess
`-- pom.xml

Again suppose project "fooUI" depends on project "barBusinessLogic", which depends on project "bazDataAccess".

fooUI --> barBusinessLogic --> bazDataAccess

But furthermore, suppose "quzUI" depends on "quzAdditionalLogic", which depends on "barBusinessLogic."

quzUI --> quzAdditionalLogic --> barBusinessLogic --> bazDataAccess

If you try to run mvn reactor:make -Dmake.folders=quzUI, you'll get an error:

mvn reactor:make -Dmake.folders=quzUI
[INFO] Folder doesn't exist: /home/person/svn/trunk/quzUI

Naturally, you'll have to specify the complete relative path to quzUI, like this:

mvn reactor:make -Dmake.folders=quz/quzUI

15 January 2010

Maven AppAssembler

Appassembler generates artifacts exposing your Java app through Java Service Wrapper


Installing PHPoxy under an secure website (https) is a simple way of being able to visit sites that may not be possible through a corporate firewall.

Install PHProxy in Your Web Space to Access Blocked Sites - Proxy - Lifehacker

HornetQ - another JMS implementation from Jboss

HornetQ - putting the buzz in messaging - JBoss Community

Why should I use HornetQ?

JMS and above - HornetQ supports the JMS 1.1 API
and also defines its own messaging API for maximum performance and
flexibility. Other protocols are planned for upcoming releases.

Superb performance
- HornetQ class-beating high performance journal provides persistent
messaging performance at rates normally seen for non-persistent
messaging. Non-persistent messaging performance rocks the boat too.


Solid high availability
- HornetQ offers server replication and automatic client failover to
eliminate lost or duplicated messages in case of server failure.

Flexible clustering
- Create clusters of HornetQ servers that know how to load balance
messages. Link geographically distributed clusters over unreliable
connections to form a global network. Configure routing of messages in
other way round.

Management - HornetQ provides
a comprehensive management API to manage & monitor servers. It is
integrated seamlessly to the servers to work in a HA environment.

Notes on Oracle Coherence | Architects Zone

Google Wave

Frequently Asked Questions About Google Wave - Google Wave - Lifehacker

A: Two words: Google Wave is multimedia wikichat.


Q: Why would I use Wave instead of email?


Q: Then why would I use Wave instead of IM?








Q: So, what would I actually use Wave for?


* group event planning, like a party, trip, wedding
* co-writing and editing—whether it's books, blogs, brochures, policies
* surveys
* translations
* project management

Biased Locking - Cliff Click

Some interesting comments on biased locking at Cliff Click Jr.’s Blog
Recently I re-did HotSpot's internal locking mechanism for Azul's JVM. The old locking mechanism is approaching 15 years old and features a number of design decisions that are now out-dated:

1. Recursion counts are kept as a NULL word on the stack for every recursion depth (i.e., counting in Base 1 math) in order to save a few instructions and a few bits of memory. Both are now in vast plentiful supply. On the 1st lock of an object, it's header is moved into the stack word instead of a NULL and this means that GC or other locking threads (or threads installing a hash code) all need to find and update the header word - which can now be "displaced". This mechanism is complex, racey and error prone.
2. The existing mechanism requires a strong memory fence after a Compare-And-Swap (CAS) op, but on most machines the CAS also includes a memory fence. I.e., HotSpot ends up fencing *twice* for each lock acquire, once to CAS the header and again moving the displaced header to the stack. Each memory fence costs about a cache-miss on most X86 CPUs.
4. When a lock does see contention it "inflates" and then the "inflated" lock is much more expensive than a fast-path "thin lock". So even the smallest bit of contention will cause a lock to be much more expensive than the good case.

01 January 2010

Wrong Correctness | Bruce Eckel

Wrong Correctness | Bruce Eckel

Some interesting points:



People not resources


Problem with standard interviews for selecting people


[JavaSpecialists 179] - Escape Analysis

[JavaSpecialists 179] - Escape Analysis. Wow, this article is showing some huge improvements with escape analysis. A reasonable complex use-case I tested showed no significant difference when it was first released. Maybe I should try -XX:+DoEscapeAnalysis again, along with -XX:+UseCompressedOops and -XX:+AggressiveOpts. Some notes from 6u14:

Optimization Using Escape Analysis

Compressed Object Pointers

Improvement TreeMap Iteration

Creating Intellij Live Templates Quickly

Creating live templates from… templates | JetBrains IntelliJ IDEA Blog. New Year's resolution to use more live templates?

Takeaways on Responsive Design | Javalobby

Takeaways on Responsive Design | Javalobby




JGroups 2.8.0GA


Website notes
  • Joining and leaving of groups
  • Membership detection and notification about joined/left/crashed members
  • Detection and removal of crashed members