Mercurial > dive4elements > river
annotate flys-backend/src/main/java/de/intevation/flys/model/HYKFlowZone.java @ 5779:ebec12def170
Datacage: Add a pool of builders to make it multi threadable.
XML DOM is not thread safe. Therefore the old implementation only allowed one thread
to use the builder at a time. As the complexity of the configuration
has increased over time this has become a bottleneck of the whole application
because it took quiet some time to build a result. Furthermore the builder code path
is visited very frequent. So many concurrent requests were piled up
resulting in long waits for the users.
To mitigate this problem a round robin pool of builders is used now.
Each of the pooled builders has an independent copy of the XML template
and can be run in parallel.
The number of builders is determined by the system property
'flys.datacage.pool.size'. It defaults to 4.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Sun, 21 Apr 2013 12:48:09 +0200 |
parents | 31d8638760b1 |
children |
rev | line source |
---|---|
1210
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.model; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 import java.io.Serializable; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 import java.math.BigDecimal; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 import javax.persistence.Entity; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 import javax.persistence.Id; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 import javax.persistence.Table; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 import javax.persistence.GeneratedValue; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 import javax.persistence.Column; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 import javax.persistence.SequenceGenerator; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 import javax.persistence.GenerationType; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 import javax.persistence.OneToOne; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 import javax.persistence.JoinColumn; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 @Entity |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 @Table(name = "hyk_flow_zones") |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 public class HYKFlowZone |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 implements Serializable |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 { |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 private Integer id; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 private HYKFormation formation; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 private HYKFlowZoneType type; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 private BigDecimal a; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 private BigDecimal b; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 public HYKFlowZone() { |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 } |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 public HYKFlowZone( |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 HYKFormation formation, |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 HYKFlowZoneType type, |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 BigDecimal a, |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 BigDecimal b |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 ) { |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 this.formation = formation; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 this.type = type; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 this.a = a; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 this.b = b; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 } |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 @Id |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 @SequenceGenerator( |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 name = "SEQUENCE_HYK_FLOW_ZONES_ID_SEQ", |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 sequenceName = "HYK_FLOW_ZONES_ID_SEQ", |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 allocationSize = 1) |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 @GeneratedValue( |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 strategy = GenerationType.SEQUENCE, |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 generator = "SEQUENCE_HYK_FLOW_ZONES_ID_SEQ") |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 @Column(name = "id") |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 public Integer getId() { |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
53 return id; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
54 } |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
55 |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 public void setId(Integer id) { |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 this.id = id; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 } |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
60 @OneToOne |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 @JoinColumn(name = "formation_id") |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
62 public HYKFormation getFormation() { |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
63 return formation; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
64 } |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
65 |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
66 public void setFormation(HYKFormation formation) { |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
67 this.formation = formation; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
68 } |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
70 @OneToOne |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
71 @JoinColumn(name = "type_id") |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
72 public HYKFlowZoneType getType() { |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
73 return type; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
74 } |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
75 |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
76 public void setType(HYKFlowZoneType type) { |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
77 this.type = type; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
78 } |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
79 |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
80 @Column(name = "a") |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
81 public BigDecimal getA() { |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
82 return a; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
83 } |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
84 |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
85 public void setA(BigDecimal a) { |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
86 this.a = a; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
87 } |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
88 |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
89 @Column(name = "b") |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
90 public BigDecimal getB() { |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
91 return b; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
92 } |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
93 |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
94 public void setB(BigDecimal b) { |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
95 this.b = b; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
96 } |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
97 } |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
98 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |