mirror of
https://github.com/gnosygnu/xowa.git
synced 2025-05-31 22:44:34 +00:00
Wbase: Add lock to pid_mgr else multi-threaded issues
This commit is contained in:
parent
265388a889
commit
f7558a6761
@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.addons.apps.cfgs.mgrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*; import gplx.xowa.addons.apps.cfgs.*;
|
||||
import org.junit.*; import gplx.core.tests.*; import gplx.dbs.*; import gplx.xowa.addons.apps.cfgs.dbs.*;
|
||||
public class Xocfg_cache_mgr__tst {
|
||||
private final Xocfg_cache_mgr__fxt fxt = new Xocfg_cache_mgr__fxt();
|
||||
// private final Xocfg_cache_mgr__fxt fxt = new Xocfg_cache_mgr__fxt();
|
||||
@Test public void Basic() {
|
||||
// fxt.Init__db_add("en.w", "key_1", "val_1");
|
||||
// fxt.Test__get("en.w", "key_1", "val_1");
|
||||
|
@ -37,8 +37,10 @@ public class Wbase_pid_mgr { // EX: "en|road_map" -> 15 ("Property:P15")
|
||||
byte[] pid_key = Bry_.Add(lang_key, Byte_ascii.Pipe_bry, pid_name); // EX: "en|road_map"
|
||||
int rv = hash.Get_as_int_or(pid_key, -1);
|
||||
if (rv == -1) {
|
||||
rv = wbase_mgr.Wdata_wiki().Db_mgr().Load_mgr().Load_pid(lang_key, pid_name); if (rv == Wdata_wiki_mgr.Pid_null) return rv;
|
||||
Add(pid_key, rv);
|
||||
synchronized (hash) { // LOCK:app-level; DATE:2016-12-03
|
||||
rv = wbase_mgr.Wdata_wiki().Db_mgr().Load_mgr().Load_pid(lang_key, pid_name); if (rv == Wdata_wiki_mgr.Pid_null) return rv;
|
||||
Add(pid_key, rv);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user