Allow negative Load average in test, see #2664

* According to documentation it can be negative for some OS
(cherry picked from commit edc9fd733d7d57e95654c4fc1fefdb9d7eb52d74)
Use undefined metrics value for negative load average, see #2664
(cherry picked from commit 99cf420a376597b7340a37180d0ea89a6b3004fb)
Initial work of adaptive metrics aware routers, see #2547
(cherry picked from commit f306964fca35d7eab95727a8a7b213e3d30ce81e)

Conflicts:

	akka-cluster/src/main/scala/akka/cluster/ClusterMetricsCollector.scala
ClusterLoadBalancingRouter and refactoring of metrics, see #2547

* MetricsSelector, calculate capacity, weights and allocate weighted
  routee refs
* ClusterLoadBalancingRouterSpec
* Optional heap max
* Constants for the metric fields
* Refactoring of Metric and decay
* Rewrite of DataStreamSpec
* Correction of EWMA and removal of BigInt, BigDecimal
* Separation of MetricsCollector into trait and two classes,
  SigarMetricsCollector and JmxMetricsCollector
* This will reduce cost when sigar is not installed, such as
  avoiding throwing and catching exc for every call
* Improved error handling for loading sigar
* Made MetricsCollector implementation configurable
* Tested with sigar
(cherry picked from commit c9d206764a183fe3e1799c1359c2c56978026181)

Conflicts:

	akka-cluster/src/main/scala/akka/cluster/ClusterMetricsCollector.scala
AdaptiveLoadBalancingRouter and more refactoring of metrics, see #2547

* Refactoring of standard metrics extractors and data structures
* Removed optional value in Metric, simplified a lot
* Configuration of EWMA by using half-life duration
* Renamed DataStream to EWMA
* Incorporate review feedback
* Use binarySearch for selecting weighted routees
* More metrics selectors for the router
* Removed network metrics, since not supported on linux
* Configuration of router
* Rename to AdaptiveLoadBalancingRouter
* Remove total cores metrics, since it's the same as jmx getAvailableProcessors,
  tested on intel 24 core server and amd 48 core server, and MBP
* API cleanup
* Java API additions
* Documentation of metrics and AdaptiveLoadBalancingRouter
* New cluster sample to illustrate metrics in the documentation,
  and play around with (factorial)
(cherry picked from commit dcde7d35944dc527847314ebe6fc0ecd295390d7)

Conflicts:

	akka-cluster/src/main/scala/akka/cluster/ClusterEvent.scala
Incorparate review feedback, see #2547

* case object and case class for MixMetricsSelector
* Rename decay-half-life-duration to moving-average-half-life
* Clarification of decay-half-life-duration and collect-interval
* Removed Fields, Java compatibility issue
* Adapt for-yield variables
* Comment metrics collector constructor that takes system param
* Don't copy EWMA if not needed
* LogOf2 constant 0.69315
* Don't use mapValues
* Remove RichInt conversion
* sigar version replace tag in docs
* createDeployer factory method to make it possible to override
  deployer in subclass
* Improve readability of MetricsListener (in sample)
* Better startup of factorial sample (no sleep)
* Many minor enhancements and cleanups
(cherry picked from commit 5eec693fd08e50e60b5446924a571078305d1ca5)

Conflicts:

	akka-actor/src/main/scala/akka/serialization/Serialization.scala
	akka-cluster/src/main/scala/akka/cluster/ClusterMetricsCollector.scala
	akka-cluster/src/main/scala/akka/cluster/routing/AdaptiveLoadBalancingRouter.scala
	akka-cluster/src/test/scala/akka/cluster/MetricsCollectorSpec.scala
Incorparate more review feedback, see #2547

* negative double check
* correction of cluster specification
* add isEmpty in WeightedRoutees
(cherry picked from commit 5d874fec176dce452ab8403c721d4a8eed5e0ad3)

Conflicts:

	akka-cluster/src/test/scala/akka/cluster/MetricNumericConverterSpec.scala
Fix failing WeightedRouteesSpec, see #2547
(cherry picked from commit 39d81b37dfc11a70767e244decc7d0282bd359d5)

Conflicts:

	akka-cluster/src/test/scala/akka/cluster/routing/WeightedRouteesSpec.scala
Add Typesafe repo in cluster sample, for sigar, see #2547
(cherry picked from commit c57f84fd28b2f4471a09c03c8aed11f26baee593)
Hardening AdaptiveLoadBalancingRouterSpec, see #2547

* Problems with OOME for large heaps
* Create many small arrays instead of one large array
* Reduce half-life to get faster updates
(cherry picked from commit cba535c9b735169100bf4304ad1f00750f07f64c)
-Xmx256m for multi-node jvms, see #2547
(cherry picked from commit 1466ad84af2e926b1322700dafbdc551f93d6237)
Simplify MetricsGossip and NodeMetrics merge, see #2547

* Also fixed problem with removed nodes potentially added
  back to MetricsGossip
(cherry picked from commit e9e1580d475d5751bc57cbd99303e1be113e6fdf)

Conflicts:

	akka-cluster/src/main/scala/akka/cluster/ClusterMetricsCollector.scala
Load Cluster extension from ClusterActorRefProvider, see #2704
(cherry picked from commit 1673ccd51c09867854d0e0128a3092ca8c4f2063)
Tests for the Cluster JMX API, see #2018

* MBeanSpec
* Added Members and Unreachable to JMX API
* Removed Convergence from JMX API, because it will
  not be exposed when ticket #2692 is merged
* Updated documentation and akka-cluster script
(cherry picked from commit a7b7ab040d79aec62cd5d4a5e27e6773b84ec5fd)

Conflicts:

	akka-cluster/src/main/scala/akka/cluster/ClusterJmx.scala
	akka-kernel/src/main/dist/bin/akka-cluster
Incorporate review comments and cleanup isAvailable, see #2018

* Renamed isRunning to isTerminated (with negation of course)
* Removed Running from JMX API, since the mbean is deregistered anyway
* Cleanup isAvailable, isUnavailbe
* Misc minor
(cherry picked from commit 1df787d0c5e8bc12406e4282d979ffb6acf24de6)

Conflicts:

	akka-cluster/src/main/scala/akka/cluster/ClusterReadView.scala
Publish AddressTerminated after a member is Downed/Removed, see #2779

* Instead of when unreachable

* Note that ClusterRouterConfig is not changed, i.e. routees will be removed
  when unreachable
* Routers that are not wrapped by ClusterRouterConfig will watch as usual, i.e.
  remove routees when Terminated, i.e. node down
(cherry picked from commit 1cd3a05f418591a91058d3201dbd6dcf0f7f064b)

Conflicts:

	akka-cluster/src/main/scala/akka/cluster/ClusterEvent.scala
min-nr-of-members and registerOnMemberUp, see #2306

* Leader moves joining members to up when min-nr-of-members reached
* Tested by MinMembersBeforeUpSpec
* Used in factorial sample
* Docs
(cherry picked from commit 44ab9f116f1af816c5632c8b56457a8000ceb8df)

Conflicts:

	akka-cluster/src/main/scala/akka/cluster/ClusterDaemon.scala
Change cluster MemberEvents to only be published on convergence. See #2692

Conflicts:
	akka-cluster/src/main/scala/akka/cluster/ClusterEvent.scala
	akka-cluster/src/main/scala/akka/cluster/ClusterJmx.scala
	akka-cluster/src/main/scala/akka/cluster/ClusterMetricsCollector.scala
	akka-cluster/src/main/scala/akka/cluster/ClusterReadView.scala
	akka-cluster/src/multi-jvm/scala/akka/cluster/MultiNodeClusterSpec.scala
	akka-docs/rst/cluster/cluster-usage-java.rst
	akka-docs/rst/cluster/cluster-usage-scala.rst
	akka-kernel/src/main/dist/bin/akka-cluster
(cherry picked from commit a03460329d7f2d9ac2efc124cdb65307308132be)

Conflicts:

	akka-cluster/src/main/scala/akka/cluster/ClusterEvent.scala
	akka-cluster/src/main/scala/akka/cluster/ClusterMetricsCollector.scala
Remove check of heap max value, see #2793
(cherry picked from commit ac30175b84c1dbd12cfb9c710c4b9e7761aeb3ea)
Bump allowed times to 20 seconds since MemberUp comes later now. See #2820
(cherry picked from commit 8bf7c03158cd4e064d3eecef1b331d14c2990775)