diff options
* some more refactoring + bugfix
Diffstat (limited to 'OpenSim/Framework/Communications/Cache/AssetServer.cs')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/AssetServer.cs | 67 |
1 files changed, 32 insertions, 35 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetServer.cs b/OpenSim/Framework/Communications/Cache/AssetServer.cs index a374df2..b17f65a 100644 --- a/OpenSim/Framework/Communications/Cache/AssetServer.cs +++ b/OpenSim/Framework/Communications/Cache/AssetServer.cs | |||
@@ -1,29 +1,29 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
@@ -57,11 +57,6 @@ namespace OpenSim.Framework.Communications.Cache | |||
57 | { | 57 | { |
58 | SetUpAssetDatabase(); | 58 | SetUpAssetDatabase(); |
59 | } | 59 | } |
60 | |||
61 | this._localAssetServerThread = new Thread(new ThreadStart(RunRequests)); | ||
62 | this._localAssetServerThread.IsBackground = true; | ||
63 | this._localAssetServerThread.Start(); | ||
64 | |||
65 | } | 60 | } |
66 | 61 | ||
67 | public void CreateAndCommitAsset(AssetBase asset) | 62 | public void CreateAndCommitAsset(AssetBase asset) |
@@ -76,6 +71,8 @@ namespace OpenSim.Framework.Communications.Cache | |||
76 | 71 | ||
77 | override public void Close() | 72 | override public void Close() |
78 | { | 73 | { |
74 | base.Close(); | ||
75 | |||
79 | if (db != null) | 76 | if (db != null) |
80 | { | 77 | { |
81 | MainLog.Instance.Verbose("Closing local asset server database"); | 78 | MainLog.Instance.Verbose("Closing local asset server database"); |
@@ -83,7 +80,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
83 | } | 80 | } |
84 | } | 81 | } |
85 | 82 | ||
86 | private void RunRequests() | 83 | override protected void RunRequests() |
87 | { | 84 | { |
88 | while (true) | 85 | while (true) |
89 | { | 86 | { |
@@ -135,12 +132,12 @@ namespace OpenSim.Framework.Communications.Cache | |||
135 | db.Commit(); | 132 | db.Commit(); |
136 | } | 133 | } |
137 | 134 | ||
138 | private void SetUpAssetDatabase() | 135 | protected virtual void SetUpAssetDatabase() |
139 | { | 136 | { |
140 | MainLog.Instance.Verbose("LOCAL ASSET SERVER", "Setting up asset database"); | 137 | MainLog.Instance.Verbose("LOCAL ASSET SERVER", "Setting up asset database"); |
141 | 138 | ||
142 | ForEachDefaultAsset(this, StoreAsset); | 139 | ForEachDefaultAsset(StoreAsset); |
143 | ForEachXmlAsset(this, StoreAsset); | 140 | ForEachXmlAsset(StoreAsset); |
144 | } | 141 | } |
145 | } | 142 | } |
146 | 143 | ||