Mercurial > dive4elements > framework
changeset 330:3168af23aec5
Added a CallContext.isInBackground() method to determine if an Artifact or a Collection has started a background thread and is currently locked.
artifacts/trunk@2666 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 07 Sep 2011 13:51:02 +0000 |
parents | 666417d5781c |
children | 089c6f7794b5 |
files | ChangeLog artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactCallContext.java artifact-database/src/main/java/de/intevation/artifactdatabase/CollectionCallContext.java artifacts/src/main/java/de/intevation/artifacts/CallContext.java |
diffstat | 4 files changed, 26 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu Aug 25 14:30:59 2011 +0000 +++ b/ChangeLog Wed Sep 07 13:51:02 2011 +0000 @@ -1,3 +1,12 @@ +2011-09-07 Ingo Weinzierl <ingo@intevation.de> + + * artifacts/src/main/java/de/intevation/artifacts/CallContext.java, + artifact-database/src/main/java/de/intevation/artifactdatabase/CollectionCallContext.java, + artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactCallContext.java: + The CallContext got a new method isInBackground() that determines, if + the Artifact or Collection (currently not implemented) has started a + background thread and is locked. + 2011-08-25 Ingo Weinzierl <ingo@intevation.de> * artifacts-common/src/main/java/de/intevation/artifacts/common/utils/FileTools.java:
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactCallContext.java Thu Aug 25 14:30:59 2011 +0000 +++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactCallContext.java Wed Sep 07 13:51:02 2011 +0000 @@ -73,6 +73,11 @@ } + public boolean isInBackground() { + return database.getLockedIds().contains(artifact.getId()); + } + + public Long getTimeToLive() { return artifact.getTTL(); }
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/CollectionCallContext.java Thu Aug 25 14:30:59 2011 +0000 +++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/CollectionCallContext.java Wed Sep 07 13:51:02 2011 +0000 @@ -51,6 +51,12 @@ } + public boolean isInBackground() { + log.debug("CollectionCallContext.isInBackground - NOT IMPLEMENTED"); + return false; + } + + public Long getTimeToLive() { log.debug("CollectionCallContext.getTimeToLive - NOT IMPLEMENTED"); return null;
--- a/artifacts/src/main/java/de/intevation/artifacts/CallContext.java Thu Aug 25 14:30:59 2011 +0000 +++ b/artifacts/src/main/java/de/intevation/artifacts/CallContext.java Wed Sep 07 13:51:02 2011 +0000 @@ -65,6 +65,12 @@ void afterBackground(int action); /** + * Returns true, if the object forked a background thread and has not + * finished it yet. + */ + boolean isInBackground(); + + /** * Access to the global context of the runtime system. * @return The global context. */