to Brian:
okay, I think I see what you mean: The BufferedOutputStream is able to read
a file only when the file is not being read by any other
BufferedOutputStream object at the same time. Generally speaking, when
saying an object is synchronized, it usually means that when two threads are
trying to invoke this object's methods simultaneously, one thread has to
wait untill the other is done - which is not the case here, as two different
BufferedOutputStream objects or more are used simultaneously. It is the file
itself which is synchronized. get my drift?

to Joe:
I'm afraid we're having somewhat of deaf people's conversation here. Read
Brian's original post and his response and see what I mean. Thanks for the
through explanation anyway...
zm.


-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Brian Bohnet
Sent: Tuesday, January 15, 2002 11:38 PM
To: [EMAIL PROTECTED]
Subject: Re: Downloading files with jsp/servlets...


Well, Zvika,
according to my team, the file requested for download was being locked
by using BufferedOutputStream(being synchronized by default), so any
other requests for that file were not allowed until the previous request
was finished reading/writing to buffer.
Hope that helps,
Brian
Zvika Markfeld wrote:
>
> but why does the synchronousity prevent simultaneous download? The output
> stream gets declared and obtained inside service() method, doesn't it? and
> if so, as any other local variable/object, it gets duplicated for each and
> every one of the threads that invokes that servlet instance, so there
isn't
> a common monitor that locks other requests/ Am I missing something here?
> Could you please explain that matter?
> zm.
>
> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Brian Bohnet
> Sent: Tuesday, January 15, 2002 12:40 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Downloading files with jsp/servlets...
>
> Joe Cheng wrote:
> >
> > Can you post the servlet code?  What servlet container are you using
> > (WebLogic, Tomcat...?)
> >
> > The servlet should absolutely be able to handle two simultaneous
requests,
> > unless your service method is synchronized.
> >
> >
>
===========================================================================
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> >  http://archives.java.sun.com/jsp-interest.html
> >  http://java.sun.com/products/jsp/faq.html
> >  http://www.esperanto.org.nz/jsp/jspfaq.jsp
> >  http://www.jguru.com/faq/index.jsp
> >  http://www.jspinsider.com
>
> Well we have figured out a solution. Since the BufferedOutputStream is
> synchronized, only one request had access to the file object at one time
> so, we wrote a new class that is very similar to BufferedOutputStream.
> This new class relies on the operating system to delegate bandwidth and
> thread the simultaneous processes for the same file, allowing
> asynchronous downloads from the same servlet.
> The servlet passes the responsibility on to the new class to handle the
> reading/writing of the file contents. Also, during testing we had 5
> requests for the same file occur, and all five began and ended
> downloading a 56M file within seconds of each other and all with equally
> balanced bandwidth on Dell servers running linux7.1 using Apache/Tomcat
> configuration.
>
> Thanks for your response.
> Brian
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to