Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/exports/LegendSection.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 | 2c86dd618c84 |
children |
rev | line source |
---|---|
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.exports; |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 /** |
3148
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
5 * Settings regarding legend of chart. |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 */ |
2058
f97cf2e350c9
Some refactoring done: all Sections subclass TypeSection now to be able to use the convinience methods for string, integer, double and boolean attributes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2046
diff
changeset
|
8 public class LegendSection extends TypeSection { |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 |
3148
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
10 public static final String VISIBILITY_ATTR = "visibility"; |
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
11 public static final String FONTSIZE_ATTR = "font-size"; |
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
12 public static final String AGGREGATION_ATTR = "aggregation-threshold"; |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 public LegendSection() { |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 super("legend"); |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 } |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 |
3148
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
20 /** Register font size attribute and value. */ |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 public void setFontSize(int fontSize) { |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 if (fontSize <= 0) { |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 return; |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 } |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 |
2058
f97cf2e350c9
Some refactoring done: all Sections subclass TypeSection now to be able to use the convinience methods for string, integer, double and boolean attributes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2046
diff
changeset
|
26 setIntegerValue(FONTSIZE_ATTR, fontSize); |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 } |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 |
2046
2ae0627f956e
Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1990
diff
changeset
|
30 public Integer getFontSize() { |
2058
f97cf2e350c9
Some refactoring done: all Sections subclass TypeSection now to be able to use the convinience methods for string, integer, double and boolean attributes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2046
diff
changeset
|
31 return getIntegerValue(FONTSIZE_ATTR); |
2046
2ae0627f956e
Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1990
diff
changeset
|
32 } |
2ae0627f956e
Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1990
diff
changeset
|
33 |
2ae0627f956e
Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1990
diff
changeset
|
34 |
3148
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
35 public Integer getAggregationThreshold() { |
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
36 return getIntegerValue(AGGREGATION_ATTR); |
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
37 } |
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
38 |
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
39 |
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
40 public void setAggregationThreshold(int aggregationThreshold) { |
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
41 setIntegerValue(AGGREGATION_ATTR, Math.abs(aggregationThreshold)); |
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
42 } |
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
43 |
2c86dd618c84
Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2064
diff
changeset
|
44 |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 public void setVisibility(boolean visibility) { |
2058
f97cf2e350c9
Some refactoring done: all Sections subclass TypeSection now to be able to use the convinience methods for string, integer, double and boolean attributes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2046
diff
changeset
|
46 setBooleanValue(VISIBILITY_ATTR, visibility); |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 } |
2046
2ae0627f956e
Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1990
diff
changeset
|
48 |
2ae0627f956e
Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1990
diff
changeset
|
49 |
2ae0627f956e
Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1990
diff
changeset
|
50 public Boolean getVisibility() { |
2058
f97cf2e350c9
Some refactoring done: all Sections subclass TypeSection now to be able to use the convinience methods for string, integer, double and boolean attributes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2046
diff
changeset
|
51 return getBooleanValue(VISIBILITY_ATTR); |
2046
2ae0627f956e
Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1990
diff
changeset
|
52 } |
1990
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 } |
5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |