Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/artifacts/transitions/DefaultTransition.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 | b2ea89a665bc |
children |
line wrap: on
line source
package de.intevation.flys.artifacts.transitions; import org.w3c.dom.Node; import de.intevation.artifacts.Artifact; import de.intevation.artifactdatabase.state.State; import de.intevation.artifactdatabase.transition.Transition; /** * The default implementation of a <code>Transition</code>. * * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class DefaultTransition implements Transition { /** The ID of the current state */ protected String from; /** The ID of the target state */ protected String to; /** * The default constructor. */ public DefaultTransition() { } /** * The default constructor. * * @param from The current state. * @param to The target state. */ public DefaultTransition(String from, String to) { this.from = from; this.to = to; } public void init(Node config) { // nothing to do in the default transition } /** * Returns the current state ID. * * @return the current state ID. */ public String getFrom() { return from; } /** * Returns the target state ID. * * @return the target state ID. */ public String getTo() { return to; } /** * Set the current state ID. * * @param from current state ID. */ public void setFrom(String from) { this.from = from; } /** * Set the target state ID. * * @param to the target state ID. */ public void setTo(String to) { this.to = to; } /** * Determines if its valid to step from state <i>a</i> of an artifact * <i>artifact</i> to state <i>b</i>. This method always returns true - no * validation takes place. * * @param artifact The owner artifact of state a and b. * @param a The current state. * @param b The target state. * * @return true, if it is valid to step from a to b, otherwise false. */ public boolean isValid(Artifact artifact, State a, State b) { return true; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :