Question

Is registering components on castle windsor thread-safe?

I.e., can multiple threads simultaneously register components on the same container instance?

(For the record, yes I am aware that doing so is probably insane.)

Was it helpful?

Solution

It's quite hard to tell whether a complex piece of software like Windsor is thread-safe or not. Windsor has several subsystems and internal services. And each component registration can do lots of stuff (setting up proxies, different lifestyles, custom dependencies...). AFAIK there are no thread-safety specific tests.

However, assuming you're using the default subsystems and your threads don't add custom contributors, subresolvers, etc (i.e. just plain component registration) it should be thread-safe, since the classes involved in component registration look like they're either stateless or properly locked. The DefaultKernel mostly delegates operations to the various subsystems/internal services, and in particular the DefaultNamingSubSystem (the services maps storage subsystem) is properly locked.

I recommend that you ask on the castle-users or castle-dev google groups, that's where the real Castle gurus are.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top