AMQP-327 Fix Stack Overflow in log4j AmqpAppender

If the spring-amqp classes are configured to use the appender, a
stack overflow will occur if DEBUG (and in some cases WARN) is enabled.

The initial call to append creates a connection factory which can then
attempt to log (again calling append), which again tries to create a
connection factory etc.

Replace the synchronized block with an AtomicBoolean.compareAndSet
operation. This prevents concurrent calls to the initialization code
(even if on the same thread). Now, if a log message is generated during
initialization, it goes straight into the events queue, bypassing the
in-process initialization.

If the initialization fails, the boolean is reset, allowing the next
append to attempt initialization.

Add a test to simulate the scenario by calling append while in the
initialization block. Verify that the initialization block is called
once only.

Add a test to verify the initialization logic is retried until
successful.
Merge pull request #111 from garyrussell/AMQP-327

* garyrussell-AMQP-327:
  AMQP-327 Fix Stack Overflow in log4j AmqpAppender