Uploaded image for project: 'Olingo'
  1. Olingo
  2. OLINGO-999

Cannot add more than one request into ChangSet - thread halts in infinite loop

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      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

      Attachments

        1. blocking2.png
          164 kB
          Sagar
        2. blocking1.png
          154 kB
          Sagar
        3. $metadata.xml
          3.70 MB
          Punith DG
        4. BatchTest.java
          4 kB
          Punith DG

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            punith619 Punith DG
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment