I am working on some performance improvements on OpenID in Identity Server (using the IS 3.2.3). The method to generate Associations is synchronized and so it will lock the entire method. As I see, the reason for this is to avoid duplicate values for association handle.
components/identity/org.wso2.carbon.identity.provider/3.2.0/src/main/java/org/wso2/carbon/identity/provider/openid/OpenIDServerAssociationStore.java The generate method is synchronized. According to the code, this is needed to avoid conflicts with having duplicate handle values. public synchronized Association generate(String type, int expiryIn) throws AssociationException { String handle = storeId + timestamp + "-" + counter++; Association association = Association.generate(type, handle, expiryIn); // caching the association cache.addToCache(association); // persisting in the database log.debug("Stroing association " + association.getHandle() + " in the database."); new OpenIDAssociationDAO(associationStoreType).storeAssociation(association); return association; } Suggested code is below. The getUUID() method is already synchronized. import org.apache.ws.security.util.UUIDGenerator; public Association generate(String type, int expiryIn) throws AssociationException { String handle = UUIDGenerator.getUUID(); Association association = Association.generate(type, handle, expiryIn); // caching the association cache.addToCache(association); // persisting in the database log.debug("Stroing association " + association.getHandle() + " in the database."); new OpenIDAssociationDAO(associationStoreType).storeAssociation(association); return association; } Was there any specific requirement to generate the handle like below ? storeId + timestamp + "-" + counter++; Any thoughts ?? -- Thanks & Best Regards, Tharindu Edirisinghe Software Engineer *WSO2 Inc* *email : tharin...@wso2.com <tharin...@wso2.com> * *mobile : +94 775 181586* *www: :http://wso2.com <http://wso2.com/> *lean . enterprise . middleware
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev