From 8a34d1b710349b955b118d616f6ddabc76ae7f1f Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 8 Mar 2012 18:28:46 -0800 Subject: 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. --- .../Connectors/Asset/HGAssetServiceConnector.cs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services/Connectors/Asset') diff --git a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs index bb5d51f..c395178 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; -- cgit v1.1