Define a listener class implementing HttpSessionListener and whenever an object is added to Http Session object, keep track of the number of instances.
Define a listener class implementing HttpSessionBindingListener and in the valueBound() method, keep track of the number of instances being added in a static variable.
It is highly impossible to keep track the number of objects being added to a Http Session in a Web Application.
The Servlet API provides direct support for keeping track the object instances.