Mercurial Hosting > luan
comparison src/luan/modules/http/LuanDomainHandler.java @ 1578:c922446f53aa
immutable threading
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 08 Feb 2021 14:16:19 -0700 |
parents | 8fbcc4747091 |
children | 46cf5137cb6b |
comparison
equal
deleted
inserted
replaced
1577:60e5c324adf9 | 1578:c922446f53aa |
---|---|
4 import goodjava.webserver.Response; | 4 import goodjava.webserver.Response; |
5 import goodjava.webserver.Handler; | 5 import goodjava.webserver.Handler; |
6 import goodjava.webserver.handlers.DomainHandler; | 6 import goodjava.webserver.handlers.DomainHandler; |
7 import luan.Luan; | 7 import luan.Luan; |
8 import luan.LuanTable; | 8 import luan.LuanTable; |
9 import luan.LuanCloner; | |
10 import luan.LuanFunction; | 9 import luan.LuanFunction; |
11 import luan.LuanException; | 10 import luan.LuanException; |
12 import luan.modules.logging.LuanLogger; | 11 import luan.modules.logging.LuanLogger; |
13 | 12 |
14 | 13 |
17 private final Luan luanInit; | 16 private final Luan luanInit; |
18 private final DomainHandler domainHandler = new DomainHandler(this); | 17 private final DomainHandler domainHandler = new DomainHandler(this); |
19 | 18 |
20 public LuanDomainHandler(Luan luanInit) { | 19 public LuanDomainHandler(Luan luanInit) { |
21 LuanLogger.initThreadLogging(); | 20 LuanLogger.initThreadLogging(); |
22 LuanCloner cloner = new LuanCloner(LuanCloner.Type.COMPLETE); | 21 this.luanInit = new Luan(luanInit); |
23 this.luanInit = (Luan)cloner.clone(luanInit); | |
24 } | 22 } |
25 | 23 |
26 @Override public Handler newHandler(String domain) { | 24 @Override public Handler newHandler(String domain) { |
27 Luan luan = newLuan(domain); | 25 Luan luan = newLuan(domain); |
28 return new LuanHandler(luan,domain); | 26 return new LuanHandler(luan,domain); |
29 } | 27 } |
30 | 28 |
31 protected Luan newLuan(final String domain) { | 29 protected Luan newLuan(final String domain) { |
32 LuanCloner cloner = new LuanCloner(LuanCloner.Type.COMPLETE); | 30 Luan luan = new Luan(luanInit); |
33 Luan luan = (Luan)cloner.clone(luanInit); | |
34 LuanFunction reset_luan = new LuanFunction() { | 31 LuanFunction reset_luan = new LuanFunction() { |
35 @Override public Object call(Luan luan,Object[] args) { | 32 @Override public Object call(Luan luan,Object[] args) { |
36 domainHandler.removeHandler(domain); | 33 domainHandler.removeHandler(domain); |
37 return LuanFunction.NOTHING; | 34 return LuanFunction.NOTHING; |
38 } | 35 } |