You are not logged in.
Announcement
Unanswered posts
|
Pages: 1

Hi,
I've created two jobs, and I need to transmit an Object "ArrayList" to the childjob.
So I put my array list in the context : context.put(myArrayList);
Then, I call the childjob with a component tRunJob, with "Transmit whole context" checked. So it should transmit my list to the child's context.
But when I execute that, my array list is cast in a String (so there is a ClassCastException), because method "runJob" of each job only accepts String parameter.
So it seems to be impossible to transmit something else than a String.
Do you have a solution ?
Thanks
Best regards,
Jean-Marie
Offline
Hello
But when I execute that, my array list is cast in a String (so there is a ClassCastException), because method "runJob" of each job only accepts String parameter.
yes, the Array have been transmit as a String (for example: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]), so we can get the values from this String and set them into a new Array in child job.(see my screenshot)
Best
Offline

Hi Jean-Marie,
I think you are right. Actual the transfer is based on simple strings. I took a closer look on the code but it is some month ago. But if I remember right all transfer is based on a string. Your data is not casted, th toString()-function is used. Later in the subJob the string is parsed. This is an additional (and not necessary) overhead, error-prone and limited to simple types.
But a change to this functionality would need a greater change in the overall class design and the components.
I tried another solution with the following code. In this example i take a list of values (1,2,3,4,5) each in one row into a list and try to transfer the data into a sub job.
dataInput -> tJavaFlex -> tRunJob
mainJob:
tJavaFlex
//start code java.util.ArrayList dataList= new java.util.ArrayList(); ByteArrayOutputStream baos= new ByteArrayOutputStream(); ObjectOutputStream oos= new ObjectOutputStream(baos); // main code dataList.add(row2.testData); row3.testData2= dataList; oos.writeObject(dataList); oos.flush(); row3.testData2= baos.toString(); //end code oos.close();
subJob:
tJavaRow
ByteArrayInputStream bais = new ByteArrayInputStream(((String)input_row.data).getBytes()); ObjectInputStream ois = new ObjectInputStream(bais); output_row.data= (String) ois.readObject();
The result is now an InvalidClassException because of the serialVersionUID. To resolve this issue I have to create a custom, modified ArrayList and stoped working for now.
But with this example it would be possible to transfer every object which implements "Serializable".
Bye
Volker
Offline

I added [Bugtracker, bug 5968, open] Enhancement optimization of context transfer of tRunJob concerning this thread.
Offline
Pages: 1