Merge pull request #195 from lburgazzoli/master

[reactor-core] OSGi : make net.openhft.chronicle optional #194
Changed the existing send(OUT) method to return a Promise.

To avoid having to create too many Promises that might never get used in a fire-and-forget scenario, I changed the Consumer<Boolean> onComplete to a Deferred<Boolean, Promise<Boolean>>, which can be null. If it's not, then the success value or an exception is fulfilled in the Promise. If it's null, then errors are only reported on the internal events Reactor which can be handled by calling TcpConnection.when(Throwable, Consumer<Throwable>).
Fixes for Resequencer so it passes the tests
Rewrite the IndexedChronicleQueuePersistor to use Chronicle 2.0. Also fixed some bugs by re-working how QueuePersistors are used by the PersistentQueue.

Also added a Codec facility to the QueuePersistor and implemented some codecs like Java serialization, JSON mapping using Jackson, String, and byte[].
Fix the test for a recent change in the connection API.
Checking random failure on CI server.
Remove usage of a global NULL_EVENT because it's dangerous if code sets the key and/or replyTo.
Added Jackson + Afterburner JsonPathSelector implementation for matching JsonPath expressions against key objects.

Internally this is implemented by providing an intelligent JsonProvider for Jackson 2. This means the JsonPathSelector can match against JSON data in the form of a String, a byte[], a Map, a List, or a JsonNode read from ObjectMapper.readTree(json).

Initial benchmark performance tests show about 1.2M selections/sec on a new MacBook Pro. That's considerably less than the ObjectSelector, which can get as much as 18-20M selectors/sec. But the flexibility of being able to assign Consumers based on the values extracted from a single JSON document is probably worth the trade-off if you need that functionality.
Tweak the JsonPathSelector for higher throughput. Now getting throughput for JsonPathSelectors that is very nearly comparable to using the ObjectSelector directly. The more selections that are done, the higher the throughput, but numbers in excess of 20M selections/sec are possible using JsonPath over a POJO.
Due to the discussion on 4a7ec44, slightly tweaked the signature of send(OUT data) to return a Promise<Void>.

Returning Promise<Boolean> was slightly confusing because a successful send would complete the Promise with true, but an unsuccessful send would complete the Promise with an error instead of false. Completing the Promise with Void now makes the intent clear: you're not going to get a return value from a send, just be notified of success or failure via the Promise.

Since the Promise *is* an onComplete handler, there's no need to have another method for send(OUT data, Deferred onComplete). Removed that method from the interface and placed it on the Abstract class as a protected method for internal use.

Also added a sendAndForget(OUT data) variant which naively publishes data on the channel with no Promise being created to monitor the success/failure. This version of the method is really intended for situations where errors are already being handled via a call to when(Class<Throwable>, Consumer<Throwable>) and the overhead of creating new Promises for each send would be too high. The sendAndForget method is meant to be very lightweight in situations where you might be issuing a large number of sends very quickly.
Addresses PR #196. Makes sure Promise is only completed once, either for failure or success.
Added some helper methods for creating Reactors.
Added an ExpressionSelector implementation which uses SpEL to match selection keys.

An existing EvaluationContext can be reused with the ExpressionSelectors created, or some helper methods exist to create a default one for you. One can also pass the helper method a BeanFactory and have all the beans available in that BeanFactory available to the Selectors to aid in matching.

The test demonstrates how to use it, but basically it goes something like:

    reactor.on(E("name == 'Match This!'"), new Consumer<Event<?>>() {
      public void accept(Event<?> ev) {
        // The bean is my key
        Bean b = (Bean)ev.getKey();
        String name = b.getName();
        ... etc...
      }
    });
    reactor.notify(new Bean("Match This!"));

It's not necessary to pass the bean as the data in an Event, though that might be preferable for clarity's sake.
Upgrade to netty 4.0.11.Final
Merge pull request #198 from daschl/netty-upgrade

Upgrade to netty 4.0.11.Final
Add async logging to reactor-tcp tests.
Add notifyError method.
Tweak how certain exceptions are handled in the ChannelInboundHandler.
Default to async logging in the tests.
For sendAndReceive, remove the internal response Queue mechanism and replace it with an anonymous Selector/key combo.

Using a Queue was exhibiting undesirable memory usage and GC side-effects so the Queue was removed and replaced with a simple anonymous Selector that is bound in the scope of a send request. The cancelAfterUse flag is set as well so it will clean up after itself when it has processed the next response from the peer.