diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLGridUserData.cs (renamed from OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs) | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs b/OpenSim/Data/MySQL/MySQLGridUserData.cs index 2e39cd0..df29ecd 100644 --- a/OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs +++ b/OpenSim/Data/MySQL/MySQLGridUserData.cs | |||
@@ -26,35 +26,39 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Threading; | ||
30 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
31 | using System.Text; | 30 | using System.Data; |
31 | using System.Reflection; | ||
32 | using System.Threading; | ||
33 | using log4net; | ||
34 | using OpenMetaverse; | ||
35 | using OpenSim.Framework; | ||
36 | using MySql.Data.MySqlClient; | ||
32 | 37 | ||
33 | namespace OpenGridServices.Manager | 38 | namespace 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(); | 46 | |
47 | public MySQLGridUserData(string connectionString, string realm) : base(connectionString, realm, "UserGrid") {} | ||
39 | 48 | ||
40 | public void Enqueue(T value) | 49 | public GridUserData GetGridUserData(string userID) |
41 | { | 50 | { |
42 | lock (_queueSync) | 51 | GridUserData[] ret = Get("UserID", userID); |
43 | { | 52 | |
44 | _queue.Enqueue(value); | 53 | if (ret.Length == 0) |
45 | Monitor.Pulse(_queueSync); | 54 | return null; |
46 | } | 55 | |
56 | return ret[0]; | ||
47 | } | 57 | } |
48 | 58 | ||
49 | public T Dequeue() | 59 | public bool StoreGridUserData(GridUserData data) |
50 | { | 60 | { |
51 | lock (_queueSync) | 61 | return Store(data); |
52 | { | ||
53 | if (_queue.Count < 1) | ||
54 | Monitor.Wait(_queueSync); | ||
55 | |||
56 | return _queue.Dequeue(); | ||
57 | } | ||
58 | } | 62 | } |
59 | } | 63 | } |
60 | } | 64 | } \ No newline at end of file |