[hornetq-commits] JBoss hornetq SVN: r8948 - in trunk: tests/src/org/hornetq/tests/unit/core/list/impl and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Mar 23 11:18:39 EDT 2010


Author: timfox
Date: 2010-03-23 11:18:38 -0400 (Tue, 23 Mar 2010)
New Revision: 8948

Added:
   trunk/src/main/org/hornetq/utils/HQDeque.java
   trunk/src/main/org/hornetq/utils/NonConcurrentHQDeque.java
   trunk/tests/src/org/hornetq/tests/unit/core/list/impl/ConcurrentPriorityLinkedListTest.java
   trunk/tests/src/org/hornetq/tests/unit/core/list/impl/NonConcurrentPriorityLinkedListTest.java
Log:
some files i missed

Added: trunk/src/main/org/hornetq/utils/HQDeque.java
===================================================================
--- trunk/src/main/org/hornetq/utils/HQDeque.java	                        (rev 0)
+++ trunk/src/main/org/hornetq/utils/HQDeque.java	2010-03-23 15:18:38 UTC (rev 8948)
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat 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.hornetq.utils;
+
+import org.hornetq.utils.concurrent.HQIterator;
+
+/**
+ * A HQDeque
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public interface HQDeque<T>
+{
+   void addFirst(T t);
+   
+   void addLast(T t);
+   
+   HQIterator<T> iterator();
+   
+   boolean isEmpty();
+   
+   T removeFirst();
+   
+   T getFirst();
+   
+   void clear();
+}

Added: trunk/src/main/org/hornetq/utils/NonConcurrentHQDeque.java
===================================================================
--- trunk/src/main/org/hornetq/utils/NonConcurrentHQDeque.java	                        (rev 0)
+++ trunk/src/main/org/hornetq/utils/NonConcurrentHQDeque.java	2010-03-23 15:18:38 UTC (rev 8948)
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat 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.hornetq.utils;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+
+import org.hornetq.core.logging.Logger;
+import org.hornetq.utils.concurrent.HQIterator;
+
+/**
+ * A NonConcurrentHQDeque
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public class NonConcurrentHQDeque<T> implements HQDeque<T>
+{
+   private static final Logger log = Logger.getLogger(ConcurrentHQDeque.class);
+
+   private final LinkedList<T> queue;
+   
+   public NonConcurrentHQDeque()
+   {
+      this.queue = new LinkedList<T>();
+   }
+   
+   public synchronized void addFirst(T t)
+   {
+      queue.addFirst(t);
+   }
+
+   public void addLast(T t)
+   {
+      queue.add(t);
+   }
+
+   public void clear()
+   {
+      queue.clear();
+   }
+
+   public synchronized T getFirst()
+   {     
+      return queue.getFirst();    
+   }
+
+   public boolean isEmpty()
+   {
+      return queue.isEmpty();
+   }
+
+   public HQIterator<T> iterator()
+   {
+      return new Iter();
+   }
+
+   public T removeFirst()
+   {
+      return queue.removeFirst();
+   }
+
+   private class Iter implements HQIterator<T>
+   {
+      private Iterator<T> iter;
+      
+      private Iter()
+      {
+         iter = queue.iterator();
+      }
+
+      public T next()
+      {
+         if (iter.hasNext())
+         {
+            return iter.next();
+         }
+         else
+         {
+            return null;
+         }         
+      }
+
+      public void remove()
+      {
+         iter.remove();
+      }
+      
+   }
+}

Added: trunk/tests/src/org/hornetq/tests/unit/core/list/impl/ConcurrentPriorityLinkedListTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/list/impl/ConcurrentPriorityLinkedListTest.java	                        (rev 0)
+++ trunk/tests/src/org/hornetq/tests/unit/core/list/impl/ConcurrentPriorityLinkedListTest.java	2010-03-23 15:18:38 UTC (rev 8948)
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat 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.hornetq.tests.unit.core.list.impl;
+
+import org.hornetq.utils.PriorityLinkedListImpl;
+
+/**
+ * A ConcurrentPriorityLinkedListTest
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public class ConcurrentPriorityLinkedListTest extends PriorityLinkedListTestBase
+{
+
+   @Override
+   protected PriorityLinkedListImpl<Wibble> getList()
+   {
+      return new PriorityLinkedListImpl<Wibble>(true, 10);
+   }
+
+}

Added: trunk/tests/src/org/hornetq/tests/unit/core/list/impl/NonConcurrentPriorityLinkedListTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/list/impl/NonConcurrentPriorityLinkedListTest.java	                        (rev 0)
+++ trunk/tests/src/org/hornetq/tests/unit/core/list/impl/NonConcurrentPriorityLinkedListTest.java	2010-03-23 15:18:38 UTC (rev 8948)
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat 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.hornetq.tests.unit.core.list.impl;
+
+import org.hornetq.utils.PriorityLinkedListImpl;
+
+/**
+ * A NonConcurrentPriorityLinkedListTest
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public class NonConcurrentPriorityLinkedListTest extends PriorityLinkedListTestBase
+{
+
+   @Override
+   protected PriorityLinkedListImpl<Wibble> getList()
+   {
+      return new PriorityLinkedListImpl<Wibble>(false, 10);
+   }
+
+}



More information about the hornetq-commits mailing list