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.
parent
9c8ef96301
commit
8a34d1b710
|
@ -45,6 +45,24 @@ namespace OpenSim.Services.Connectors
|
||||||
LogManager.GetLogger(
|
LogManager.GetLogger(
|
||||||
MethodBase.GetCurrentMethod().DeclaringType);
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
private Dictionary<IAssetService, object> m_endpointSerializer = new Dictionary<IAssetService, object>();
|
||||||
|
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<string, IAssetService> m_connectors = new Dictionary<string, IAssetService>();
|
private Dictionary<string, IAssetService> m_connectors = new Dictionary<string, IAssetService>();
|
||||||
|
|
||||||
public HGAssetServiceConnector(IConfigSource source)
|
public HGAssetServiceConnector(IConfigSource source)
|
||||||
|
@ -197,7 +215,8 @@ namespace OpenSim.Services.Connectors
|
||||||
IAssetService connector = GetConnector(url);
|
IAssetService connector = GetConnector(url);
|
||||||
// Restore the assetID to a simple UUID
|
// Restore the assetID to a simple UUID
|
||||||
asset.ID = assetID;
|
asset.ID = assetID;
|
||||||
return connector.Store(asset);
|
lock (EndPointLock(connector))
|
||||||
|
return connector.Store(asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
return String.Empty;
|
return String.Empty;
|
||||||
|
|
Loading…
Reference in New Issue