Access to Instances

Your agent code can give the agent library access to your object instances. The agent library can call methods of those instances. You can either register a single instances, or register a provider that lets the agent library request instances on demand.

Access to Instances

Instance Registration

Your stand-alone agent code can register a specific instance by calling TeaAgentServer.registerInstance (green arrow in the diagram above).

Your servlet agent code can register an instance by including it in the array that is the value of the servlet's getObjectInstances method.

On-Demand Access though Providers

Your agent code can also allow access to instances on demand by registering a provider instance. That is, your agent code:
  1. defines an object type class (in interface style) that implements TeaObject
  2. defines a corresponding provider class that implements TeaObjectProvider<T extends TeaObject>
  3. instantiates a provider object
  4. registers the provider object (orange arrow in the diagram)
After this preparation, the agent library can call TeaObjectProvider<T>.getInstance to gain access to any instance of that object type (red arrow in the diagram).

For more information, see Provider

Note: Access to your instances within the agent library could affect memory management.