ACCUMULO-1858 Backport ZooKeeper clean up to 1.4 and 1.5.

Fix cherry picks two commits:

ACCUMULO-1379 - Adding close() to Instance to assist in freeing up resources

(cherry picked from commit 7da1164d87227960d3e0cfc841f753067e2c0304)

Reason: bugfix
Author: John Vines <jvines@gmail.com>

Differs from original by path changes and leaving out ConditionalWriterTest, which is only in 1.6.0+

----

ACCUMULO-1379 Fix edge cases if error in closing ZooKeeperInstance

(cherry picked from commit 3f6c66ede52cb1fb5a122d7bad06d7978ff0a671)

Reason: bugfix
Author: Christopher Tubbs <ctubbsii@apache.org>

Signed-off-by: Bill Slacum <ujustgotbilld@apache.org>
Merge remote-tracking branch 'apache-committers/1.4.5-SNAPSHOT' into 1.5.1-SNAPSHOT

Conflicts:
	core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
	core/src/main/java/org/apache/accumulo/core/client/impl/ThriftTransportPool.java
	core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java
	examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchWriter.java
	fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooReader.java
	server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
Merge branch '1.5.1-SNAPSHOT' of https://git-wip-us.apache.org/repos/asf/accumulo into 1.5.1-SNAPSHOT

Conflicts:
	examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchWriter.java
ACCUMULO-1858 Fixed compilation error from bad merge.

The old merge&push bit me as I was missing a '}'.
ACCUMULO-1892 redo resolving conflict resolution from 1.4 merge
ACCUMULO-1833 Account for race condition in test where mutations are flushed immediately.
Merge remote-tracking branch 'apache-committers/1.5.1-SNAPSHOT' into 1.6.0-SNAPSHOT

Did a merge for ACCUMULO-1858 and picked some "Elser" slack.

Conflicts:
	core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
	server/base/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
ACCUMULO-1831 fix recovered log cleanup
ACCUMULO-1903 prefer the cached, reusable ZooReaderWriter over raw Zookeeper API
ACCUMULO-1903 prefer the cached, reusable ZooReaderWriter over raw Zookeeper API
ACCUMULO-1903 prefer the cached, reusable ZooReaderWriter over raw Zookeeper API
ACCUMULO-1901 treat the gc start/stop like the redundant masters
ACCUMULO-1901 treat the gc start/stop like the redundant masters
ACCUMULO-1901 treat the gc start/stop like the redundant masters
ACCUMULO-1901 treat the gc start/stop like the redundant masters
Merge branch '1.5.1-SNAPSHOT' into 1.6.0-SNAPSHOT
ACCUMULO-1889 mark ZKI as closed once close() is called.

Once a given ZKI has .close() called, mark that instance closed regardless of outstanding client count.

Signed-off-by: Eric Newton <eric.newton@gmail.com>
ACCUMULO-1901 treat the gc start/stop like the redundant masters
Merge branch '1.5.1-SNAPSHOT' into 1.6.0-SNAPSHOT
ACCUMULO-1873 Better ZOOKEEPER_HOME check in start-all.sh

The script now checks that ZOOKEEPER_HOME is a directory and detects
when the search for a ZK JAR comes up empty.

Signed-off-by: Eric Newton <eric.newton@gmail.com>