NHibernate.Search needs to maintain data per transaction. It does this by maintaining a WeakHashtable which maps a transaction to a PostTransactionWorkQueueSynchronization.
The problem I see with this approach is with high volume (large number of transactions) systems. Every time a new entry is added to the WeakHashtable, the entire table is checked for weak references. If there is a large number of concurrent transactions, this can become very expensive. The object NHibernate.Search wants to store with the transaction is an ISynchronization registered through ITransaction.RegisterSynchronization. I was wondering whether it would be possible if a different mechanism could be devised to accomplish the same, but without use of a WeakHashtable. Constructs like providing an IDictionary for user data with an ITransaction, or providing access to the AdoTransaction.synchronizations come to mind.
