Skip to main content

svn commit: r23 - trunk/JOODAMP/src/org/joodamp/multiprocessor: datastore queue testing

  • From: pradeep_d@...
  • To: commits@...
  • Subject: svn commit: r23 - trunk/JOODAMP/src/org/joodamp/multiprocessor: datastore queue testing
  • Date: 22 May 2009 14:10:53 -0000
  • Mailing-list: contact commits-help@...; run by ezmlm

Author: pradeep_d
Date: 2009-05-22 14:10:51+0000
New Revision: 23

Modified:
   
trunk/JOODAMP/src/org/joodamp/multiprocessor/datastore/QueueFileMarshal.java
   
trunk/JOODAMP/src/org/joodamp/multiprocessor/datastore/QueueFileUnMarshal.java
   trunk/JOODAMP/src/org/joodamp/multiprocessor/queue/Queue.java
   trunk/JOODAMP/src/org/joodamp/multiprocessor/queue/QueueInput.java
   trunk/JOODAMP/src/org/joodamp/multiprocessor/queue/QueueOutput.java
   trunk/JOODAMP/src/org/joodamp/multiprocessor/testing/InputDO.java
   trunk/JOODAMP/src/org/joodamp/multiprocessor/testing/Main.java
   trunk/JOODAMP/src/org/joodamp/multiprocessor/testing/OutputDO.java

Log:


Modified: 
trunk/JOODAMP/src/org/joodamp/multiprocessor/datastore/QueueFileMarshal.java
Url: 
https://joodamp.dev.java.net/source/browse/joodamp/trunk/JOODAMP/src/org/joodamp/multiprocessor/datastore/QueueFileMarshal.java?view=diff&rev=23&p1=trunk/JOODAMP/src/org/joodamp/multiprocessor/datastore/QueueFileMarshal.java&p2=trunk/JOODAMP/src/org/joodamp/multiprocessor/datastore/QueueFileMarshal.java&r1=22&r2=23
==============================================================================
--- 
trunk/JOODAMP/src/org/joodamp/multiprocessor/datastore/QueueFileMarshal.java  
      (original)
+++ 
trunk/JOODAMP/src/org/joodamp/multiprocessor/datastore/QueueFileMarshal.java  
      2009-05-22 14:10:51+0000
@@ -52,9 +52,11 @@
             while(pool.isOutputDataAvailable(queueName)) {
                 output=pool.getOutputputData(queueName);
                 if(output != null) {
-                    String obj = (String) output.marshal();
+                    String obj = (String) output.unPack();
                     writer.write(obj,0,obj.length());
                     writer.newLine();
+                    //System.out.println("Line written: "+obj);
+                    writer.flush();
                 }
             }
         }catch(Exception e) {

Modified: 
trunk/JOODAMP/src/org/joodamp/multiprocessor/datastore/QueueFileUnMarshal.java
Url: 
https://joodamp.dev.java.net/source/browse/joodamp/trunk/JOODAMP/src/org/joodamp/multiprocessor/datastore/QueueFileUnMarshal.java?view=diff&rev=23&p1=trunk/JOODAMP/src/org/joodamp/multiprocessor/datastore/QueueFileUnMarshal.java&p2=trunk/JOODAMP/src/org/joodamp/multiprocessor/datastore/QueueFileUnMarshal.java&r1=22&r2=23
==============================================================================
--- 
trunk/JOODAMP/src/org/joodamp/multiprocessor/datastore/QueueFileUnMarshal.java
      (original)
+++ 
trunk/JOODAMP/src/org/joodamp/multiprocessor/datastore/QueueFileUnMarshal.java
      2009-05-22 14:10:51+0000
@@ -53,7 +53,7 @@
             DataFactory factory = pool.getInputDataFactory(queueName);
             while((line = reader.readLine()) != null) {
                 DataInput input = (DataInput) factory.createInstance();
-                input.unMarshal(line);
+                input.pack(line);
                 pool.addInputData(queueName,(DataInput)input);
             }
         }catch(Exception e) {

Modified: trunk/JOODAMP/src/org/joodamp/multiprocessor/queue/Queue.java
Url: 
https://joodamp.dev.java.net/source/browse/joodamp/trunk/JOODAMP/src/org/joodamp/multiprocessor/queue/Queue.java?view=diff&rev=23&p1=trunk/JOODAMP/src/org/joodamp/multiprocessor/queue/Queue.java&p2=trunk/JOODAMP/src/org/joodamp/multiprocessor/queue/Queue.java&r1=22&r2=23
==============================================================================
--- trunk/JOODAMP/src/org/joodamp/multiprocessor/queue/Queue.java       
(original)
+++ trunk/JOODAMP/src/org/joodamp/multiprocessor/queue/Queue.java       
2009-05-22 14:10:51+0000
@@ -9,6 +9,7 @@
 
 package org.joodamp.multiprocessor.queue;
 
+import java.util.concurrent.TimeUnit;
 import org.joodamp.multiprocessor.data.Data;
 
 /**
@@ -16,6 +17,8 @@
  * @author Pradeep.Duraisamy
  */
 public interface Queue {
+    public int timeOut = 1;
+    public TimeUnit timeUnit = TimeUnit.SECONDS;
     public boolean isQueueEmpty();
     public boolean isCompleted();
     public int getFreeSpace();

Modified: trunk/JOODAMP/src/org/joodamp/multiprocessor/queue/QueueInput.java
Url: 
https://joodamp.dev.java.net/source/browse/joodamp/trunk/JOODAMP/src/org/joodamp/multiprocessor/queue/QueueInput.java?view=diff&rev=23&p1=trunk/JOODAMP/src/org/joodamp/multiprocessor/queue/QueueInput.java&p2=trunk/JOODAMP/src/org/joodamp/multiprocessor/queue/QueueInput.java&r1=22&r2=23
==============================================================================
--- trunk/JOODAMP/src/org/joodamp/multiprocessor/queue/QueueInput.java  
(original)
+++ trunk/JOODAMP/src/org/joodamp/multiprocessor/queue/QueueInput.java  
2009-05-22 14:10:51+0000
@@ -59,7 +59,7 @@
     public Data pop() {
         Data data = null;
         try {
-            data = (Data)queue.take();
+            data = (Data)queue.poll(timeOut,timeUnit);
         }catch(Exception e) {
             e.printStackTrace(System.out);
         }

Modified: trunk/JOODAMP/src/org/joodamp/multiprocessor/queue/QueueOutput.java
Url: 
https://joodamp.dev.java.net/source/browse/joodamp/trunk/JOODAMP/src/org/joodamp/multiprocessor/queue/QueueOutput.java?view=diff&rev=23&p1=trunk/JOODAMP/src/org/joodamp/multiprocessor/queue/QueueOutput.java&p2=trunk/JOODAMP/src/org/joodamp/multiprocessor/queue/QueueOutput.java&r1=22&r2=23
==============================================================================
--- trunk/JOODAMP/src/org/joodamp/multiprocessor/queue/QueueOutput.java 
(original)
+++ trunk/JOODAMP/src/org/joodamp/multiprocessor/queue/QueueOutput.java 
2009-05-22 14:10:51+0000
@@ -59,7 +59,7 @@
     public Data pop() {
         Data data = null;
         try {
-            data = (Data)queue.take();
+            data = (Data)queue.poll(timeOut, timeUnit);
         }catch(Exception e) {
             e.printStackTrace(System.out);
         }

Modified: trunk/JOODAMP/src/org/joodamp/multiprocessor/testing/InputDO.java
Url: 
https://joodamp.dev.java.net/source/browse/joodamp/trunk/JOODAMP/src/org/joodamp/multiprocessor/testing/InputDO.java?view=diff&rev=23&p1=trunk/JOODAMP/src/org/joodamp/multiprocessor/testing/InputDO.java&p2=trunk/JOODAMP/src/org/joodamp/multiprocessor/testing/InputDO.java&r1=22&r2=23
==============================================================================
--- trunk/JOODAMP/src/org/joodamp/multiprocessor/testing/InputDO.java   
(original)
+++ trunk/JOODAMP/src/org/joodamp/multiprocessor/testing/InputDO.java   
2009-05-22 14:10:51+0000
@@ -29,6 +29,14 @@
     }
 
     public void unMarshal(Object obj) {
+        
+    }
+
+    public Data createInstance() {
+        return new InputDO();
+    }
+
+    public void pack(Object obj) {
         String str = (String)obj;
         StringTokenizer st = new StringTokenizer(str,",");
         st.hasMoreElements();
@@ -37,7 +45,7 @@
         b = Integer.parseInt(st.nextToken());
     }
 
-    public Data createInstance() {
-        return new InputDO();
+    public Object unPack() {
+        return a+","+b;
     }
 }

Modified: trunk/JOODAMP/src/org/joodamp/multiprocessor/testing/Main.java
Url: 
https://joodamp.dev.java.net/source/browse/joodamp/trunk/JOODAMP/src/org/joodamp/multiprocessor/testing/Main.java?view=diff&rev=23&p1=trunk/JOODAMP/src/org/joodamp/multiprocessor/testing/Main.java&p2=trunk/JOODAMP/src/org/joodamp/multiprocessor/testing/Main.java&r1=22&r2=23
==============================================================================
--- trunk/JOODAMP/src/org/joodamp/multiprocessor/testing/Main.java      
(original)
+++ trunk/JOODAMP/src/org/joodamp/multiprocessor/testing/Main.java      
2009-05-22 14:10:51+0000
@@ -23,11 +23,12 @@
     public Main() {
     }
     public static void main(String args[]) throws Exception {
-        MultiProcessor processor = new 
MultiProcessor(org.joodamp.multiprocessor.testing.TestTask.class,3,true,null);
+        MultiProcessor processor = new 
MultiProcessor(org.joodamp.multiprocessor.testing.TestTask.class,3,false,null);
         
         processor.addInputQueue("input",10000,new 
FileInputStream("c:\\temp\\input.txt"),new 
InputDO(),MultiProcessor.DATASTORE_FILE,null);
         processor.addOutputQueue("output",10000,new 
FileOutputStream("c:\\temp\\output.txt"),null,MultiProcessor.DATASTORE_FILE,null);
         
         processor.start();
+        System.out.println("End");
     }
 }

Modified: trunk/JOODAMP/src/org/joodamp/multiprocessor/testing/OutputDO.java
Url: 
https://joodamp.dev.java.net/source/browse/joodamp/trunk/JOODAMP/src/org/joodamp/multiprocessor/testing/OutputDO.java?view=diff&rev=23&p1=trunk/JOODAMP/src/org/joodamp/multiprocessor/testing/OutputDO.java&p2=trunk/JOODAMP/src/org/joodamp/multiprocessor/testing/OutputDO.java&r1=22&r2=23
==============================================================================
--- trunk/JOODAMP/src/org/joodamp/multiprocessor/testing/OutputDO.java  
(original)
+++ trunk/JOODAMP/src/org/joodamp/multiprocessor/testing/OutputDO.java  
2009-05-22 14:10:51+0000
@@ -30,5 +30,13 @@
     public Object marshal() {
         return a +","+b+","+sum;
     }
+
+    public void pack(Object obj) {
+        
+    }
+
+    public Object unPack() {
+        return a +","+b+","+sum;
+    }
     
 }




svn commit: r23 - trunk/JOODAMP/src/org/joodamp/multiprocessor: datastore queue testing

pradeep_d 05/22/2009
 
 
Close
loading
Please Confirm
Close