Divide the MSB source codes into two repos
[msb/apigateway.git] / apiroute / apiroute-service / src / main / java / org / onap / msb / apiroute / wrapper / queue / BaseQueue.java
diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/queue/BaseQueue.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/queue/BaseQueue.java
new file mode 100644 (file)
index 0000000..dce3b12
--- /dev/null
@@ -0,0 +1,36 @@
+package org.onap.msb.apiroute.wrapper.queue;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+
+public abstract class BaseQueue<T> {
+  
+  private final List<BlockingQueue<ServiceData<T>>> queueArray= new ArrayList<BlockingQueue<ServiceData<T>>>(); 
+  
+  public BaseQueue(int queueNum,int queueCapacity)
+  {   
+      for(int i=0;queueNum>0 && i<queueNum;i++)
+      {
+          queueArray.add(new LinkedBlockingQueue<ServiceData<T>>(queueCapacity));
+      }
+  }
+  
+  public int getQueneNum(){
+    return queueArray.size();
+  }
+  
+  protected BlockingQueue<ServiceData<T>> getQueue(int index)
+  {
+      return queueArray.get(index);
+  }
+
+  public abstract void put(final ServiceData<T> data) throws InterruptedException;
+  
+  public abstract ServiceData<T> take(final int queueIndex) throws InterruptedException;
+  
+  
+  
+
+}