This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
krl servlets & concurrency
- From: "62945" <62945 at bol dot com dot br>
- To: "kawa" <kawa at sources dot redhat dot com>
- Date: Sun, 8 Aug 2004 13:07:47 -0300
- Subject: krl servlets & concurrency
Examining the krl translation (kawa --servlet --krl -C
vs.scm) of
[ (define x 1)
(set! x (+ x 1)) ]
[x]
we_see_(with_a_jode_disassemby/thanks_to_Chris_Dean):------------------------
... more
public class vs extends KawaServlet
{
public final Symbol x
= gnu.mapping.Environment.getCurrent().getSymbol("x");
static final UnescapedData Lit0;
static final IntNum Lit1;
static final UnescapedData Lit2;
public int numArgs() {
return 0;
}
public final void apply(CallContext $ctx) {
Consumer $result = $ctx.consumer;
$result.writeObject(Lit0);
x.set(Lit1);
$result.writeObject(Lit2);
x.set(AddOp.$Pl.apply2(Lit1,
Interpreter.getSymbolValue(x)));
$result.writeObject(Lit2);
Object object = Interpreter.getSymbolValue(x);
Consumer consumer = $result;
consumer.writeObject(object);
$result.writeObject(Lit0);
}
... more
----------------------------------------------------------------------
"x" gets translated to a class var. As I have expressed
my concern this code looks unsafe for concurrency. An
equivalent jsp code:
<% int x = 1;
x++; %>
<%= x %>
gives:----------------------------------------------------------------
... more
public void _jspService(HttpServletRequest request,
HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html");
pageContext = _jspxFactory.getPageContext(this,
request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write('\n');
int x = 1;
x++;
out.write('\n');
out.write('\n');
out.print( x );
out.write('\n');
... more
----------------------------------------------------------------------
the jsp translation puts "x" inside the "_jspService"
method and it looks safe. Please instruct me if I'm
wrong, but shouldn't (or couldn't) "x" in the kawa
translation be placed inside "apply".
__________________________________________________________________________
Acabe com aquelas janelinhas que pulam na sua tela.
AntiPop-up UOL - É grátis!
http://antipopup.uol.com.br/