abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yogesh Mujumdar" <yogesh.mujum...@gmail.com>
Subject Re: app client goes in infinite wait state...
Date Fri, 02 Feb 2007 17:10:58 GMT
Well, for the time being my problem seems to be solved. Will definitely make
a test case to demonstrate the problem, but not now. Right now i am on
gunpoint to complete the work. If you are interested to get an overview of
the pbm and how i solved it continue reading.

My APP server has two media collections. The code is to copy media entries
from one collection to another media collection. For each media entry the
algorithm i use is :

1. Get the Media link entry from coll1.
2. Extract the "edit-media" link from the media link entry.
3. Make a URLConnection on the "edit-media" link(which is an arbitrary file)
4. Get the inputstream from the URLConnection and pass it to Abdera client
along with
    the coll2 url to post to the server.
5. The server returns the media link entry of the newly created resource in
coll2.
6. The client then updates the summary, title etc and makes a PUT on the
media link
    entry "edit" url.

Note : The file is not buffered before POSTing to the new collection.

In step 6 when the client updates the summary, title, it also updates the
author information(right now the server does not support authentication).
The code looks like this :

mediaLinkEntry.addAuthor(config.getUsername());
> mediaLinkEntry.setSummary(summary);


Inspite of config.getUsername() returning a proper string ("yogesh" in my
case) the author element is not added to the entry. The funny part is that,
if i put a breakpoint at setSummary and check the value of mediaLinkEntry in
eclipse, it shows the author element but if i dont put the breakpoint,
though the code executes, but the author element is not added and my server
throws exceptions.

Immediately after the server throws an exception, if i again make a GET
request on any collection, the client goes in an infinite wait. There is no
problem with the server.

So there are two problems here :
1. The author element not getting added.
2. Client going in wait state.

This is how i have temporarily solved.

After step 3, the file is buffered locally and then the inputstream of the
buffered file is given to Abdera client along with the coll2 url to POST to
the server.

The server stores the file and returns the media link entry of the newly
created resource.

Add another mediaLinkEntry.addAuthor(config.getUsername()); after the
setSummary is called. Now the code looks like this :

mediaLinkEntry.addAuthor(config.getUsername());
> mediaLinkEntry.setSummary(summary);
> mediaLinkEntry.addAuthor(config.getUsername());


This works. The author element is added and no wait state pbm :) I dunno how
and why.
Ugo, as you suggested, i have added the release call after every request.

I am still not sure of this solution. Need to test more.

On 2/2/07, Ugo Cei <ugo.cei@gmail.com> wrote:
>
>
> On Feb 1, 2007, at 10:02 PM, Yogesh Mujumdar wrote:
>
> > Sometimes, after executing a POST, if i execute a GET, the client
> > goes in
> > infinite wait state. When digged down, the actual wait is in the
> > MultiThreadedHttpConnectionManager, somewhere at line number 509 i
> > guess.
> >
> > I feel the problem is in the connection pool. Any way to set it to
> > size 1?
> > Any way to have a single threaded http connection manager? I know
> > this is
> > not a relevant question to ask here, but since i am facing the pbm
> > while
> > using abdera, i am taking the liberty to ask :)
> >
> > I am struck here from past 3 days... gave up today. Please help me :(
>
> Call release() on the ClientResponse object you get from every
> request that you do.
>
>         Ugo
>
>
>
> --
> Ugo Cei
> Blog: http://agylen.com/
> Open Source Zone: http://oszone.org/
> Evil or Not?: http://evilornot.info/
> Company: http://www.sourcesense.com/
>
>
>


-- 
regards/Yogesh

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message