@SuppressWarnings("unchecked")
  public static void invokeSamplers(Object o) {
    // Remember the last object for this thread, skip if seen already.
    if (lastObject.get() == o) {
      return;
    }
    lastObject.set(o);

    Class<?> currentClass = o.getClass();
    while (currentClass != null) {
      List<ConstructorCallback<?>> samplers = samplerMap.get(currentClass);
      if (samplers != null) {
        // Leave in the @SuppressWarnings, because we define -Werror,
        // and infrastructure sometimes runs with all warnings turned
        // on.  This would be a great place for a typesafe
        // heterogeneous container, but that doesn't work with generic
        // types.
        for (@SuppressWarnings("rawtypes") ConstructorCallback sampler : samplers) {
          sampler.sample(o);
        }
        // Return once the first list of registered samplers are found and
        // invoked.
        return;
      } else {
        // When subclassesAlso is not specified (default), return if no
        // samplers are registered with the type of the currently-constructed
        // object.  Otherwise, traverse upward the class hierarchy.
        if (!subclassesAlso) {
          return;
        }
        currentClass = currentClass.getSuperclass();
      }
    }
  }
Bytecode is rewritten to invoke this method; it calls the sampler for the given class. Note
that, unless the javaagent command line argument "subclassesAlso" is specified, it won't do
anything if o is a subclass of the class that was supposed to be tracked.

@param o the object passed to the samplers.
src/main/java/com/google/monitoring/runtime/instrumentation/ConstructorInstrumenter.java