From 0f86540ae239fcbaa7248940837e6e2662527941 Mon Sep 17 00:00:00 2001 From: Keith Donald Date: Mon, 31 Mar 2008 19:13:24 +0000 Subject: [PATCH] backport concurrent timeoutSeconds polish in conversation management system --- ...BadlyFormattedConversationIdException.java | 20 +++++++++++++++++++ .../impl/LockInterruptedException.java | 20 +++++++++++++++++++ .../impl/LockTimeoutException.java | 16 +++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/BadlyFormattedConversationIdException.java create mode 100644 spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/LockInterruptedException.java create mode 100644 spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/LockTimeoutException.java diff --git a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/BadlyFormattedConversationIdException.java b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/BadlyFormattedConversationIdException.java new file mode 100644 index 00000000..a31db19e --- /dev/null +++ b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/BadlyFormattedConversationIdException.java @@ -0,0 +1,20 @@ +package org.springframework.webflow.conversation.impl; + +import org.springframework.webflow.conversation.ConversationException; + +/** + * Thrown if a conversation id could not be parsed. + * + * @author Keith Donald + */ +public class BadlyFormattedConversationIdException extends ConversationException { + + /** + * Creates a new badly formatted conversation id exception. + * @param encodedId the badly formatted id + * @param parseException the cause + */ + public BadlyFormattedConversationIdException(String encodedId, Throwable parseException) { + super("Unable to parse string-encoded conversationId + '" + encodedId + "'", parseException); + } +} diff --git a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/LockInterruptedException.java b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/LockInterruptedException.java new file mode 100644 index 00000000..37faa6e5 --- /dev/null +++ b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/LockInterruptedException.java @@ -0,0 +1,20 @@ +package org.springframework.webflow.conversation.impl; + +import org.springframework.webflow.conversation.ConversationLockException; + +/** + * Exception indicating that some {@link Thread} was {@link Thread#interrupt() interrupted} during + * processing and as such processing was halted. + *

+ * Only used to wrap the checked {@link InterruptedException java.lang.InterruptedException}. + */ +public class LockInterruptedException extends ConversationLockException { + + /** + * Creates a new SystemInterruptedException. + * @param cause the root cause of this Exception + */ + public LockInterruptedException(InterruptedException cause) { + super("Unable to acquire conversation lock - thread interrupted", cause); + } +} \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/LockTimeoutException.java b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/LockTimeoutException.java new file mode 100644 index 00000000..79ff6500 --- /dev/null +++ b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/LockTimeoutException.java @@ -0,0 +1,16 @@ +package org.springframework.webflow.conversation.impl; + +import org.springframework.webflow.conversation.ConversationLockException; + +/** + * Thrown when a lock could not be acquired after a timeout period. + * + * @author Keith Donald + */ +public class LockTimeoutException extends ConversationLockException { + + public LockTimeoutException(int timeoutSeconds) { + super("Unable to acquire conversation lock after " + timeoutSeconds + " seconds"); + } + +}