IntelliJ Java IDE
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes buffer attribute verses autoflush - confusion? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply Bookmark "buffer attribute verses autoflush - confusion?" Watch "buffer attribute verses autoflush - confusion?" New topic
Author

buffer attribute verses autoflush - confusion?

Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
Attributes of the page directive...
Re buffer attribute:
Servers can use a larger buffer than you specify, but not smaller one.
So, if I specify 32kb buffer then the server can use say 64kb or 128kb ( anything > 32kb).
Good.
Re autoflush attribute:
Controls wether the output buffer should be automatically flushed when it is full or whether an Exception should be raised when buffer overflows.
What is the upper limit for the buffer?
IMO, it is set by the amt of RAM on my system.
When they talk abt the buffer overflow do they mean when I run out of RAM on my system?
Thanks for any help.
- satya


Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
ersin eser
Ranch Hand

Joined: Feb 22, 2001
Posts: 1072
The amount you set or the default 8kb
Just bought the voucher* Guess i am gonna take it this Saturday i got bored.
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
ersin:
I agree we can set it or the default value it has, but you haven't answered my qstn. We are setting the lower limit, what is the upper limit?

Just bought the voucher*
I did that at the very beginning of the year...
Guess i am gonna take it this Saturday i got bored.
Good luck.
- satya
Manjunath Subramanian
Ranch Hand

Joined: Jul 18, 2001
Posts: 236
Satya :
I tried a piece of code for evaluating your question..
<html>
<head>
<title>Buffer Test</title>
<body>
<%@ page language="java"buffer ="12800"%>
<%
out.println("Working fine with buffersize:"+out.getBufferSize());
%>
</body>
</html>
The output i got was ..
Working fine with buffersize: 13107200.
I think the buffer size is 1/10 of the ram size.
I have a 128 MB ram on a win2k m/c and so the program works fine when i set a buffer size of "12800".For a buffer set to this size the server sets a size which is shown in the output.
When i change the buffer size to "128001" then the program bombs.The lines in the log file are...
" Exception initializing page context"
"java.lang.IllegalStateException: failed initialize JspWriter"
at so and so ....
So my conclusion is that the buffer size is 1/10 of the RAM size.Of course it could also depend on the web-server.I have Tomcat-4.0.1.I don't have other servers to try this out..
The other point is that..buffer over flow occurs when we set the "autoFlush" attribute to false and we do not flush it when it is has become full and we try to write more contents into it.
Hope this helps,
Manjunath
[ January 29, 2002: Message edited by: Manjunath Subramanian ]
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
Thanks, Manjunath.
So basically, the free RAM available determines the upper limit and hence overflow can occur when autoflush is "false". On the other hand, when autoflush=true, the response is committed to the client. Thats my understanding now.
Also, I am not sure your theory of 1/10 th RAM is correct. Personally, I am comfortable thinking that it is set by the amt of free memory avail rather thatn the 1/10 th magic number.
Thanks again.
- satya
 
IntelliJ Java IDE
 
subject: buffer attribute verses autoflush - confusion?
 
Threads others viewed
default buffer size for all jsp files
JSP Problems: Exception Handling, buffer, autoFlush
IllegalStateException help me
JSP Page buffering
Is there a maximum size for a JSP?
IntelliJ Java IDE