Skip to content

Divide the class repository (Reflector) for different SqlSession Config #372

Closed
@alexey-su

Description

@alexey-su

How to divide storage classes (org.apache.ibatis.reflection.Reflector) for each OSGi bundle?

There is a set of components. Each contains a description of the classes of documents to one version.

Document version Count *.java files Size (MBytes) Count *.class files Size (MBytes) jar file size (bytes)
1.0 353 ~4.9 807 ~4.0 876216
4.1 358 ~5.0 826 ~4.1 896596
4.2 375 ~5.2 853 ~4.2 896596
4.3 436 ~6.7 1072 ~5.3 1173399
4.4 483 ~8.0 1227 ~6.1 1353393
4.5 483 ~8.0 1227 ~6.2 1360002
4.6 485 ~8.0 1230 ~6.2 1363847
5.0 508 ~8.9 1349 ~6.8 1506754
5.1 514 ~8.6 1355 ~6.8 1506568

The system documents get different versions. Depending on the version, rises OSGi service and OSGi component the structure of the documents required version. One service + One component model.

To process a single document there is no need to prepare everything at once SqlSession Mapper.
Loading Mapper interface occurs on demand.

locker.lock();
try {
    // lazy load Reflector
    Reflector.forClass(dataClass);

    // lazy load mapper
    Config config = sqlSession.getConfig();
    if(config.hasMapper(mapperClass) == null)
       config.addMapper(mapperClass);

    return config.getMapper(mapperClass);
} finaly {
    locker.unlock();
}

Periodically rid of OSGi service. ServiceTracker open / close.
See complete event service activity. JVisualVM shows purification classes in the HeapSpece.

Reflection class continues to hold classes document structures.

Disabling cache slows down the process of processing multiple documents in different threads.

I think we should add a local cache for Reflection in the base class Config.

Metadata

Metadata

Assignees

Labels

enhancementImprove a feature or add a new feature

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions