aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-08-22 19:52:03 +0100
committerJustin Clark-Casey (justincc)2014-08-22 19:52:03 +0100
commitd899bdcb9bbf1b52f91daabacfb630059757fcea (patch)
tree2b03ff0d97ae20c82aace3d73f4c6e346f7e3662
parentRemoving locking on requests in MySQLAssetData. (diff)
downloadopensim-SC-d899bdcb9bbf1b52f91daabacfb630059757fcea.zip
opensim-SC-d899bdcb9bbf1b52f91daabacfb630059757fcea.tar.gz
opensim-SC-d899bdcb9bbf1b52f91daabacfb630059757fcea.tar.bz2
opensim-SC-d899bdcb9bbf1b52f91daabacfb630059757fcea.tar.xz
Remove lock in MySQLFramework. This is not necessary as the connection is not shared.
-rw-r--r--OpenSim/Data/MySQL/MySQLFramework.cs33
1 files changed, 12 insertions, 21 deletions
diff --git a/OpenSim/Data/MySQL/MySQLFramework.cs b/OpenSim/Data/MySQL/MySQLFramework.cs
index 3fdcf1e..5820a90 100644
--- a/OpenSim/Data/MySQL/MySQLFramework.cs
+++ b/OpenSim/Data/MySQL/MySQLFramework.cs
@@ -45,38 +45,29 @@ namespace OpenSim.Data.MySQL
45 System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 45 System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 protected string m_connectionString; 47 protected string m_connectionString;
48 protected object m_dbLock = new object();
49 48
50 protected MySqlFramework(string connectionString) 49 protected MySqlFramework(string connectionString)
51 { 50 {
52 m_connectionString = connectionString; 51 m_connectionString = connectionString;
53 } 52 }
54 53
55 //////////////////////////////////////////////////////////////
56 //
57 // All non queries are funneled through one connection
58 // to increase performance a little
59 //
60 protected int ExecuteNonQuery(MySqlCommand cmd) 54 protected int ExecuteNonQuery(MySqlCommand cmd)
61 { 55 {
62 lock (m_dbLock) 56 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
63 { 57 {
64 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 58 dbcon.Open();
65 { 59 cmd.Connection = dbcon;
66 dbcon.Open();
67 cmd.Connection = dbcon;
68 60
69 try 61 try
70 { 62 {
71 return cmd.ExecuteNonQuery(); 63 return cmd.ExecuteNonQuery();
72 } 64 }
73 catch (Exception e) 65 catch (Exception e)
74 { 66 {
75 m_log.Error(e.Message, e); 67 m_log.Error(e.Message, e);
76 return 0; 68 return 0;
77 }
78 } 69 }
79 } 70 }
80 } 71 }
81 } 72 }
82} 73} \ No newline at end of file