Openfire acquires a lock with bare JID as key on users session cache in RoutingTableImpl.getRoutes(). Is this really necessary? A comment states " // temporarily block new sessions for this JID". But what would be the negative impact if there is a new session or a session gets removed inside that locked block? This can happen afterwards anyways.
Background is: This is very expensive when Openfire is clustered with hazelcast plugin. E.g. if you send 10k messages to the same bare JID (the method mentioned above gets invoked for each single message) and have clustering enabled, routing is up to 50 times slower than without clustering. Of course locking over cluster nodes is really expensive because it requires network I/O.
Does anyone know what was the intention of this lock?