From 8a34d1b710349b955b118d616f6ddabc76ae7f1f Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 8 Mar 2012 18:28:46 -0800 Subject: [PATCH] HG inventory/asset transfers: serialize asset posts. I'm using the same pattern as suggested in the patch mantis #5921. Testing it in this smaller context to see how it works. --- .../Asset/HGAssetServiceConnector.cs | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs index bb5d51fa59..c395178740 100644 --- a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs @@ -45,6 +45,24 @@ namespace OpenSim.Services.Connectors LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); + private Dictionary m_endpointSerializer = new Dictionary(); + private object EndPointLock(IAssetService connector) + { + lock (m_endpointSerializer) + { + object eplock = null; + + if (! m_endpointSerializer.TryGetValue(connector, out eplock)) + { + eplock = new object(); + m_endpointSerializer.Add(connector, eplock); + // m_log.WarnFormat("[WEB UTIL] add a new host to end point serializer {0}",endpoint); + } + + return eplock; + } + } + private Dictionary m_connectors = new Dictionary(); public HGAssetServiceConnector(IConfigSource source) @@ -197,7 +215,8 @@ namespace OpenSim.Services.Connectors IAssetService connector = GetConnector(url); // Restore the assetID to a simple UUID asset.ID = assetID; - return connector.Store(asset); + lock (EndPointLock(connector)) + return connector.Store(asset); } return String.Empty;