Win a copy of Terraform in Action this week in the Cloud forum!

Shu Gao

Greenhorn
+ Follow
since Aug 01, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Shu Gao

I think you can try changing you default locale settings.
[ January 23, 2007: Message edited by: Shu Gao ]
Hi, Dave
Servlets are bascially single-threaded that they process your requests in a single-thread, so when you do something in doGet(), doPost(), well...uh service(), everything is synchronized.

That's the traditional REQUEST-WAIT-RESPONSE model that you have to wait for the servlet to complete all of its processing before it can return any responses.

If you use a background worker thread, it would no be appropriate in this case, cause that way, you won't get a chance for a servlet to return the response, since the servlet is already returned the response while your background worker is still hanging and doing its job.

I can give you two suggestions for this problem since your business logic in this case seem to be time-consuming:

1) you can cache the data somewhere so that it would be fast enough for your servlets to fetch. However, I understand that you need to pass in some parameters before you retrieve the data.

2) You can consider AJAX whereas it's not synchronized, while you can send a request to the server and the servlet will take its time to fetch the data it requires, but your browser will not be hanged, it can resume doing its job, so when the servlet finishes processing, it'll give the browser the result in xml format.
14 years ago
Hi, I don't think there is anything wrong with your code

Since you are writing an xml response using the writer, you can commit it using:
response.getWriter().flush();
before you forward to other resources.

Hope that helps.
14 years ago
Actually, you can configure a <session-config> element
<session-config>
<session-timeout>1</session-timeout>
</session-config>
in your web.xml, so that the session will expire after a period of time. (in mins)

When the user closes the browser, the servlet-api will check on the session, when a session is checked on, it will be created, that's why the sessionCreated() method is called. And I guess in your code, this code never appears as well:
request.getSession(true);
whereas you are manually checking on a session and telling the API even if the session doesn't exists so far, create it anyway specified by the true flag.

So, if you have configured your session timeout, then after you closed your browser, when the specified time expires, say 1 minute, then after a minute, the sessionDestroyed() method will be called.
14 years ago
This code creates a cookie named 'param1', and map its value to whatever the value of the query parameter 'param1' is, and its expiry value is 1800 seconds.

developers don't need to worry about the location, the cookie is by default stored on client-end, where the location is where your browser store your temporary internet files.

Hope that helps.
14 years ago
Don't worry Ailsa, you'll get your score soon.

I got the same report at the test site saying it'll take 4-6 weeks.

But on the certmanager site, it says 2-4 weeks.

I guess I'll take the average, below 5 weeks..
[ November 03, 2005: Message edited by: Shu Gao ]
When did you submit you assignment?

As far as I know, it is a very rare occasion, score indicated passing, and didn't say automatic failure, but still F?
16 years ago
Thank you very much, Andrew and Seb
Hi, everyone:

I had finished and reviewed my project, and I am about to submit it, There are just two questions though:

1. In my project specification, it stated:
A directory called docs, containing the following items at the top level:
This html file.
...................

So I am not too sure about what this "This html file" meant, since the user help file is called "userguide.txt(or html)", and the design choises file is called "choices.txt" as well as the file that states the JDK version is called "version.txt", and all the JAVA/HTML docs are in a sub directory called javadoc, so what is this "This html file" after all?

2. How do I name my uploading submission jar file, or do I get specific instructions when I upload?

Thank you very much!

Regards.
Shu
Hi, I got the BS assignment, on the first page, the specs states:

"Bodgitt and Scarper, LLC. "

Well, is this "LLC" the company name that Bodgitt and Scarper owns?

I know this is a stupid question, don't laugh at me, I just wanted to make sure.

Thanks in advance!
Thank you, james

lot of hints for me

and Congratulations to you again !
16 years ago
Congratulations, James

Can u tell us a little bit about your locking approach?

Thanks in advance
16 years ago

Originally posted by Andrew Monkhouse:
Hi Shu, If you did not check the cookie then this code would work even if some other client owned the lock. You should defensively program your Data class so that such a scenario will not only fail but will throw the SecurityException.

wait() will work fine - most people use this

Regards, Andrew

[ August 02, 2005: Message edited by: Andrew Monkhouse ]



Thanks, Andrew, I see what u mean

really appreciate your help
Frans, Thanks a lot

Your point is very clear to me!!

Since I really don't have any solid experience on database itself, especially transaction-based system, I have no idea how it works, I've really learned a lot from your reply

By the way, can you still tell me under which circumstances that unlock() will throw that SecurityException? I don't think it is possible that unlock() even have a chance to throw it; since lock() will be called first, if succeeded, it will get the right cookie, but if not, it will give up..To be more specific, under what condition that unlock() will be called alone without lock() being called first in the same method like update() or delete()?

Finally, the specs stated that
If the specified record is already locked by a different client, the current thread gives up the CPU and consumes no CPU cycles until the record is unlocked

My question is that "give up the CPU and consumes no CPU cycles", does it mean the thread gives up totally? I was thinking about wait() at first, wait() puts a thread into a blocked state, but I wasn't too sure that if a blocked thread won't consume any CPU cycles at all...

Thanks again, everyone!

Regards

[ August 02, 2005: Message edited by: Shu Gao ]
[ August 02, 2005: Message edited by: Shu Gao ]