Fix agentCache locking.
Make AgentFactory a real Singleton pattern implementation
Migrate AgentFactory initiation to ContextListener model
More fixes to AgentCache