-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
Description
MyBatis version
3.5.9
Test case or example project
We have an application, it will start a grpc server, will load all mapper at main thread, and will receive business task from grpc client in grpc thread pool. We sometimes get the exception "Type xxx is not known to the MapperRegistry", but when we check the appliction log, we are confused why the exception will occur.
- first, we use sqlSessionTemplate.getConfiguration().addMapper(mapper); to add all the mappers. (main thread)
- then we use sqlSessionTemplate.getConfiguration().hasMapper(mapper); to check if the mapper add success.(main thread)
- last we will will wait mapper load finished by step1 and step 2, and then use sessionTemplate.getMapper(mapper); to get the mapper to use.(grpc thread pool)
As we check the code of MapperRegistry, when addMapper end, there's no way to remove mapper from the knownMappers. How did the exception occur when getMapper at step 3.
We expect getMapper success everytime at step 3.