Making AsyncChain typesafe

Another no-op ish commit to clean up the code.

Made `AsyncChain` into a builder, that tracks the type of the function per addition so that the final composed result is indeed typesafe (Metric -> IMetric mostly).

I had to go around and plumb through the code to sprinkle the type parameter everywhere.

also use the iterator instead of copying the array - more idiomatic java, and this should make things a bit more efficient.