Skip to content

Apache Commons ClassScan proposal

struberg edited this page Feb 27, 2011 · 3 revisions

Welcome to the Apache-commons-classscanner wiki!

Preface

The target of this project is to become a JSR for a plugable classpath scanning infrastructure.

THIS IS NOT YET AN OFFICIALLY SUBMITTED JSR The javax.enterprise.classscan package is only used preliminarry and is NOT yet official!

Rationale

Lots of Apache projects today make use of classpath scanning for automatically picking up functionality based upon annotations on certain classes. Currently almost all project use their own classpath scanner, thus in a scenario where a few of those projects get used, each of them uses their own classpath scanner, effectively multiplying the startup time

An example of such a Apache based stack makes this obvious:

  • Apache tomcat 7
  • Apache MyFaces 2
  • Apache BVAL (JSR-303 bean validation)
  • Apache OpenWebBeans
  • Apache OpenEJB
  • Apache OpenJPA

Quite a lot of the parts above perform their own scanning.

Solution

Apache Commons ClassScan aims to provide a library where all the frameworks mentioned above could register itself as clients and access the shared scanning results.

See the JavaDoc of the ClassScanClient for more information about how to register and deregister them. A client should call deregister if it doesn't need any more information from the ClassScanner anymore. Once all registered ClassScanClients deregistered itself, the ClassScanner will release all the respective scanning data, effectively freeing up the memory again.

Challenges

  • The classscan.jar might be located in a shared classloader
  • Support separated results for different ContextClassLoaders
  • Support shared results for parent ClassLoaders

Legal

Apache, the Apache logo, ASF, MyFaces, tomcat, OpenWebBeans, OpenJPA, BVAL, etc are trademarks of the Apache Software Foundation http://www.apache.org