Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!

fei long

Ranch Hand
+ Follow
since Apr 04, 2002
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by fei long

No worries. Exam question always tries to trick people.

One thing that might help you understand this (or any other complicated) code is to run it by yourself and see the result. Then make some changes or add some extra logging and observe the behavior. I found this helped me understand some of confusing concepts
You are right, it doesn't print out "state" variable. Those 6 7 8 9 are thread ID (printed by "Thread.currentThread().getID()") and you don't need to know why they are not 11, 310 etc. (As you see, all options start as 6 7 8, so this number is not important)

The key thing you need to know is three threads execution go to wait(), and one thread go to notify()/notifyall() and this behavior is because all threads share the access to "state" variable (not concurrently though). And it also tests "synchronized" and "thread execution order is not guaranteed" concepts
C and E should be the correct answers.

>> 6. if (state++ < 3) {
is a key line here, I think.
When new threads are created and started in line 19, 20, 21 and 22, each thread accesses this "state" variable and it gets incremented each time. First three threads will enter the "if" block and wait() forever. The fourth thread when started, since "state" has already incremented to 3, execution goes to "else" block.

Then any one of first three threads could be notified so possible outputs would be
6 7 8 6 7 8 <<== C
6 7 8 6 8 7
6 7 8 7 6 8
6 7 8 7 8 6
6 7 8 8 6 7 <<== E
6 7 8 8 7 6

Hope this helps.

Hi, I have a question about how Tomcat supports persistenct connection (by default in HTTP/1.1). My understanding about persistency related configurations is:
1. Has ability to configure how many persistent connections a container supports. (sth like persistent connection pool size)
2. Can specify timout value for one persistent connection link. (how long does client/server maintain before terminates one persistent connection)

Does Tomcat offer any configuration parameters for persistent connection, like what I metioned above?

Someone says "connectionTimeout" in server.xml is for that purpose, but I think that is the timeout value for one request. (one persistent connection can processes multiple requests)

<Connector className="org.apache.catalina.connector.http.HttpConnector"
port="8080" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="10" debug="0" connectionTimeout="60000"/>

Any comments/thoughts are appreciated :thumb:
13 years ago
they are in 'axis.jar' file
15 years ago
I know Sun's JWSDP1.3 contains SAAJ library called 'saaj-impl.jar'. Try google it first.
15 years ago
Thanks Clifford. Maybe I wasn't describing correctly. What I want is to 'specify a directory' not browse and pick up a file. It's like many software install program does when asking you to specify directory you want to install.
16 years ago
Hi all, I want to create a field which allows you to browse directory in my JSP page. But I couldn't find any information on web. Is this possible in JSP? or only could be done in Applet? Any suggestion or code snippet would be appreciated.
16 years ago
if I have tag like below in test.jsp file
<input type="text" name="xyz" value="<c ut value="${xyz}"/>" size="10">
What I don't understand is where can I find the place value 'xyz' is stored?
16 years ago
thanks Eric.
At moment, I have Combo_A, Combo_B and List_C, and Combo A and B are using ItemListener(). When I change Combo_A, Combo_B is using removeAllItems() to remove all existing contents first then trying to add new contents. But this causes event trigger on Combo_B and Comb_B is not updated properly.
Below is my basic code structue, and please revise me if I'm wrong.
16 years ago
I have two JComboBox say 'A' and 'B'. I want event change(item selection) on 'A' to trigger automatic change on another JComboBox 'B'. Items(contents) in 'B' are dynamically read from somewhere. I looked API but didn't find suitable methods. I am sure there must be a way to do the job, but couldn't figure it out. Can anyone please give me suggestion or any code snippets would be appreciated.
16 years ago
I am not quite sure how would you like to sort. But I noticed that you might have to change
int startScan = i;
for(int k =0; k < list.size()-1;k++)
Student d = (Student)list.get(k);
if(d.getLname().compareTo(s.getLname())< 0)
startScan = k;
k=0 --> k=i
in findPosition()
16 years ago
Can anyone give me an idea about how to make web site be searched by search engine (google, altavista)
i used <meta name="keywords", content="......">
is this correct? or any other good way?
If I am remember correctly, the 'ELEMENT' node type has broader range. So can you check the nodetype static variable again and try 'TEXTNODE' or something like that? Hope this helps you.
17 years ago