aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLGridUserData.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLGridUserData.cs (renamed from OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs)48
1 files changed, 26 insertions, 22 deletions
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs b/OpenSim/Data/MySQL/MySQLGridUserData.cs
index 2e39cd0..15834d2 100644
--- a/OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs
+++ b/OpenSim/Data/MySQL/MySQLGridUserData.cs
@@ -26,35 +26,39 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Threading;
30using System.Collections.Generic; 29using System.Collections.Generic;
31using System.Text; 30using System.Data;
31using System.Reflection;
32using System.Threading;
33using log4net;
34using OpenMetaverse;
35using OpenSim.Framework;
36using MySql.Data.MySqlClient;
32 37
33namespace OpenGridServices.Manager 38namespace OpenSim.Data.MySQL
34{ 39{
35 public class BlockingQueue<T> 40 /// <summary>
41 /// A MySQL Interface for user grid data
42 /// </summary>
43 public class MySQLGridUserData : MySQLGenericTableHandler<GridUserData>, IGridUserData
36 { 44 {
37 private Queue<T> _queue = new Queue<T>(); 45// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
38 private object _queueSync = new object();
39 46
40 public void Enqueue(T value) 47 public MySQLGridUserData(string connectionString, string realm) : base(connectionString, realm, "UserGrid") {}
41 {
42 lock (_queueSync)
43 {
44 _queue.Enqueue(value);
45 Monitor.Pulse(_queueSync);
46 }
47 }
48 48
49 public T Dequeue() 49 public GridUserData GetGridUserData(string userID)
50 { 50 {
51 lock (_queueSync) 51 GridUserData[] ret = Get("UserID", userID);
52 {
53 if (_queue.Count < 1)
54 Monitor.Wait(_queueSync);
55 52
56 return _queue.Dequeue(); 53 if (ret.Length == 0)
57 } 54 return null;
55
56 return ret[0];
57 }
58
59 public bool StoreGridUserData(GridUserData data)
60 {
61 return Store(data);
58 } 62 }
59 } 63 }
60} 64} \ No newline at end of file