Sushil Sharma

+ Follow
since Nov 02, 2006
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 Sushil Sharma

I am planning to take SCJP. But I am not clear as to what categories of Java -- basic language, API -- are covered in this exam? I would appreciate help from folks who have acquired this certificate

I modified loop to do a 10 x 1000000. The results are:

for loop: 125 ms
iterator: 359 ms

Platform: Windows XP, Xeon 3.2GHz, 2GB RAM, Java 1.5
14 years ago
I did a basic test to benchmark iterator and for loop. The iterator over a sample size of 10,000 runs takes 40 ms; where as for loop takes 2 ms.


14 years ago
I am running an application on a Windows XP machine. The application has massive tables in memory. Though the machine has approximately 2GB, the JVM runs out of memory. (The application is started with -Xm2GB.)

Is there a restriction in JVM about maximum size of memory it can use? Or machine/OS restricts the memory size? From my investigation a XP process can acquire 2GB.

I would appreciate your help .
14 years ago
The broken socket exception happens in MySQL JDBC driver. Check whether you have correct version of the driver, or download the latest driver.
From your email it is not clear whether you already have a ssh client.

ssh protocol is complicated. It requires generation of keys and use of SSL. You can either implement ssh client protocol and use SSL sockets; or get an open source implementation of ssh.
Are your requirements such that it cannot be filled by ftpor similar protocols?
The broken pipe is due to TCP connection lost to backend. I do not think it is a problem with JDBC or your application, but can be network problem. I would check the following:
  • are both Linux and Windows platforms on same physical network (subnet)
  • heavy traffic on the network
  • From Linux box run ping command with MySql box IP. Do same from Windows. If there is no difference between time delays, contact your IT.

  • From your code snippets, the add to vector will block until acceptsucceeds, or a timeout execption is thrown. I assume you are running server on a separate thread.

    Now as to monitor client connect/disconnect state, the Socket Api is not clear if an exception is thrown when client disconnects. The only way I can see is to have some sort of a thread which poll socket in the Vector. The thread can check Socket's .
    I am not clear what you want to profile. The performance of system is tied to the database, and number and frequency of queries. Most databases including Oracle and MySql cache tables in the memory (this happens behind the scene).

    From my experience there is not much difference, between databases, regarding queries and insertion. For some reason, accessing Blob is a problem. If your data is ASCII characters I would suggest using VARCHAR.
    14 years ago
    Sharing a common resource can be a problem, specially two or more threads access the socket. Thus, you would have to do some sort of synchronization or mutex.

    Pooling is a better idea.
    Your question is not clear. Anyway I will try:
  • Yes server can access the client (not the network) as server has the IP address of the client.
  • [/list]
  • Server does not know applications/protocols running on client, except the one by which client connected to server.
  • [/list]
    Hope this answered some of your questions.
    Google and find. There are huge amount of utilities on the web. Also, it should not be difficult to write this utility.

    Get org.apache.commons package from