diff options
author | Melanie | 2010-03-03 02:07:03 +0000 |
---|---|---|
committer | Melanie | 2010-03-03 02:07:03 +0000 |
commit | 028a87fe37002e7a0611f66babf1deee46c83804 (patch) | |
tree | 387aec499fd60c2012bed8148e6a2ddc847c3d95 /OpenSim/Data/SQLite/SQLiteAvatarData.cs | |
parent | Revert "test" (diff) | |
parent | Fixes Region.Framework tests. Although these tests don't fail, they need to b... (diff) | |
download | opensim-SC-028a87fe37002e7a0611f66babf1deee46c83804.zip opensim-SC-028a87fe37002e7a0611f66babf1deee46c83804.tar.gz opensim-SC-028a87fe37002e7a0611f66babf1deee46c83804.tar.bz2 opensim-SC-028a87fe37002e7a0611f66babf1deee46c83804.tar.xz |
Merge branch 'master' into careminster-presence-refactor
This brings careminster on the level of master. To be tested
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteAvatarData.cs (renamed from OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs) | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs b/OpenSim/Data/SQLite/SQLiteAvatarData.cs index 2e39cd0..b3f4a4c 100644 --- a/OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs +++ b/OpenSim/Data/SQLite/SQLiteAvatarData.cs | |||
@@ -26,34 +26,48 @@ | |||
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 Mono.Data.SqliteClient; | ||
32 | 37 | ||
33 | namespace OpenGridServices.Manager | 38 | namespace OpenSim.Data.SQLite |
34 | { | 39 | { |
35 | public class BlockingQueue<T> | 40 | /// <summary> |
41 | /// A SQLite Interface for Avatar Data | ||
42 | /// </summary> | ||
43 | public class SQLiteAvatarData : SQLiteGenericTableHandler<AvatarBaseData>, | ||
44 | IAvatarData | ||
36 | { | 45 | { |
37 | private Queue<T> _queue = new Queue<T>(); | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
38 | private object _queueSync = new object(); | ||
39 | 47 | ||
40 | public void Enqueue(T value) | 48 | public SQLiteAvatarData(string connectionString, string realm) : |
49 | base(connectionString, realm, "Avatar") | ||
41 | { | 50 | { |
42 | lock (_queueSync) | ||
43 | { | ||
44 | _queue.Enqueue(value); | ||
45 | Monitor.Pulse(_queueSync); | ||
46 | } | ||
47 | } | 51 | } |
48 | 52 | ||
49 | public T Dequeue() | 53 | public bool Delete(UUID principalID, string name) |
50 | { | 54 | { |
51 | lock (_queueSync) | 55 | SqliteCommand cmd = new SqliteCommand(); |
56 | |||
57 | cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = :PrincipalID and `Name` = :Name", m_Realm); | ||
58 | cmd.Parameters.Add(":PrincipalID", principalID.ToString()); | ||
59 | cmd.Parameters.Add(":Name", name); | ||
60 | |||
61 | try | ||
52 | { | 62 | { |
53 | if (_queue.Count < 1) | 63 | if (ExecuteNonQuery(cmd, m_Connection) > 0) |
54 | Monitor.Wait(_queueSync); | 64 | return true; |
55 | 65 | ||
56 | return _queue.Dequeue(); | 66 | return false; |
67 | } | ||
68 | finally | ||
69 | { | ||
70 | CloseCommand(cmd); | ||
57 | } | 71 | } |
58 | } | 72 | } |
59 | } | 73 | } |