diff options
author | Diva Canto | 2012-03-08 18:28:46 -0800 |
---|---|---|
committer | Diva Canto | 2012-03-08 18:28:46 -0800 |
commit | 8a34d1b710349b955b118d616f6ddabc76ae7f1f (patch) | |
tree | 1c74cfa39db179aafbfd1057ee6deca5a513e90f /OpenSim/Services/Connectors | |
parent | Fixes mantis #5923 (diff) | |
download | opensim-SC-8a34d1b710349b955b118d616f6ddabc76ae7f1f.zip opensim-SC-8a34d1b710349b955b118d616f6ddabc76ae7f1f.tar.gz opensim-SC-8a34d1b710349b955b118d616f6ddabc76ae7f1f.tar.bz2 opensim-SC-8a34d1b710349b955b118d616f6ddabc76ae7f1f.tar.xz |
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.
Diffstat (limited to 'OpenSim/Services/Connectors')
-rw-r--r-- | OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs | 21 |
1 files changed, 20 insertions, 1 deletions
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 | |||
45 | LogManager.GetLogger( | 45 | LogManager.GetLogger( |
46 | MethodBase.GetCurrentMethod().DeclaringType); | 46 | MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | private Dictionary<IAssetService, object> m_endpointSerializer = new Dictionary<IAssetService, object>(); | ||
49 | private object EndPointLock(IAssetService connector) | ||
50 | { | ||
51 | lock (m_endpointSerializer) | ||
52 | { | ||
53 | object eplock = null; | ||
54 | |||
55 | if (! m_endpointSerializer.TryGetValue(connector, out eplock)) | ||
56 | { | ||
57 | eplock = new object(); | ||
58 | m_endpointSerializer.Add(connector, eplock); | ||
59 | // m_log.WarnFormat("[WEB UTIL] add a new host to end point serializer {0}",endpoint); | ||
60 | } | ||
61 | |||
62 | return eplock; | ||
63 | } | ||
64 | } | ||
65 | |||
48 | private Dictionary<string, IAssetService> m_connectors = new Dictionary<string, IAssetService>(); | 66 | private Dictionary<string, IAssetService> m_connectors = new Dictionary<string, IAssetService>(); |
49 | 67 | ||
50 | public HGAssetServiceConnector(IConfigSource source) | 68 | public HGAssetServiceConnector(IConfigSource source) |
@@ -197,7 +215,8 @@ namespace OpenSim.Services.Connectors | |||
197 | IAssetService connector = GetConnector(url); | 215 | IAssetService connector = GetConnector(url); |
198 | // Restore the assetID to a simple UUID | 216 | // Restore the assetID to a simple UUID |
199 | asset.ID = assetID; | 217 | asset.ID = assetID; |
200 | return connector.Store(asset); | 218 | lock (EndPointLock(connector)) |
219 | return connector.Store(asset); | ||
201 | } | 220 | } |
202 | 221 | ||
203 | return String.Empty; | 222 | return String.Empty; |