summaryrefslogtreecommitdiff
path: root/java/common/src/main
diff options
context:
space:
mode:
authorRafael H. Schloming <rhs@apache.org>2008-02-07 18:15:20 +0000
committerRafael H. Schloming <rhs@apache.org>2008-02-07 18:15:20 +0000
commit021713fbe45e92e5eef13184be711c7156d7db00 (patch)
tree525bbaa32a1099f1ae35b0e92b03684bd6c1cdee /java/common/src/main
parent06ca351132b86961e14ee59f7353c1f7e1a0f50a (diff)
downloadqpid-python-021713fbe45e92e5eef13184be711c7156d7db00.tar.gz
added test for exception listener; fixed NPE
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@619538 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/common/src/main')
-rw-r--r--java/common/src/main/java/org/apache/qpid/util/concurrent/Condition.java50
1 files changed, 50 insertions, 0 deletions
diff --git a/java/common/src/main/java/org/apache/qpid/util/concurrent/Condition.java b/java/common/src/main/java/org/apache/qpid/util/concurrent/Condition.java
new file mode 100644
index 0000000000..bbd1722677
--- /dev/null
+++ b/java/common/src/main/java/org/apache/qpid/util/concurrent/Condition.java
@@ -0,0 +1,50 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.util.concurrent;
+
+
+/**
+ * Condition
+ *
+ */
+
+public class Condition
+{
+
+ private boolean value = false;
+
+ public synchronized void set()
+ {
+ value = true;
+ notifyAll();
+ }
+
+ public synchronized boolean get(long timeout) throws InterruptedException
+ {
+ if (!value)
+ {
+ wait(timeout);
+ }
+
+ return value;
+ }
+
+}