[ 
https://issues.apache.org/jira/browse/OLINGO-999?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15428474#comment-15428474
 ] 

Sagar commented on OLINGO-999:
------------------------------

Hi Christian,

I had look at this issue. It is going into endless code. Refer the screenshopts 
(blocking1 and blocking2). As far as I understand it looks like nobody is 
reading from PipedInputStream. Hence 
org.apache.olingo.client.core.communication.request.AbstractODataStreamer.stream(byte[])
 method is not able to write after a while. I am not sure why do we are using 
org.apache.olingo.client.core.communication.request.AbstractODataStreamer.bodyStreamWriter
 as PipedOutputStream object. Is this as designed? Can this be changed to use 
any other OutputStream.

In case of PipedOutputStream and PipedInputStream we would need two separate 
thread to write and read the streams. In our usage we just wanted to add a 
multiple change request to changeset. This is being done by the single thread. 
We are using the olingo to serialize the batch payload and deserialize the 
batch response. We have our own HTTP transport. 

Unfortunately we are not familiar with the Olingo 4.0 codebase and we need some 
solution/pointers on this issue.

We are badly stuck with this issue. I would really appreciate your help on this 
issue. 
Eagerly awaiting for your reply. Thanks a lot in advance.

Thanks,
Sagar


> Cannot add more than one request into ChangSet - thread halts in infinite loop
> ------------------------------------------------------------------------------
>
>                 Key: OLINGO-999
>                 URL: https://issues.apache.org/jira/browse/OLINGO-999
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata4-client, odata4-commons
>    Affects Versions: (Java) V4 4.2.0
>            Reporter: Punith DG
>            Priority: Blocker
>              Labels: batch, changeset, thread-safety
>         Attachments: $metadata.xml, BatchTest.java, blocking1.png, 
> blocking2.png
>
>
> I am not able to add more than one request to a batch ChangeSet as the 
> BatchManager has PipedOutputStream Writer that's causing thread to get into 
> infinite loop.
> Check the below sample code in which I'm trying to add requests. 
> for loop{
> ODataBatchRequest batchRequest = 
> client.getBatchRequestFactory().getBatchRequest("serviceRootURI");
> BatchManager payloadManager = batchRequest.payloadManager();
> ODataChangeset changeset = payloadManager.addChangeset();
> ODataEntityCreateRequest<ClientEntity> createRequest = 
> client.getCUDRequestFactory()
>                                                                               
>               .getEntityCreateRequest(new URI("serviceRoot"), clientEntity);
> createRequest.setFormat(ContentType.JSON);
> changeset.addRequest(createRequest); // here the thread waits in infinite 
> loop due to piped streams sync problem.
> }
> The problem is observed in line "request.batch(req, 
> String.valueOf(contentId));" in addRequest() method of ODataChangesetImpl 
> class.
> It seems a known issue in Java - 
> http://stackoverflow.com/questions/9171632/piped-input-stream-is-getting-locked



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to