Nitesh Kant

+ Follow
since Feb 25, 2007
Nitesh likes ...
IntelliJ IDE Java MySQL Database
Bangalore, India
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 Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nitesh Kant

What is the size(in bytes) of these files. 500K numbers isn't really a big deal and I think you would not hit the file system bottleneck as the data will typically get into the file system cache (for a properly configured file system)
I would also look at the number of threads & the amount of context switches your program is making during execution. Higher amount of context switches will lead to poor performance.
So, I would typically see whether your process is CPU or I/O bound (top in *nix systems with thread view) and then see the context switches.
If CPU bound, I will keep the number of threads close to the number of cores on the box.If I/O bound I will tune the I/O (which I doubt it is)

Edit: Reading in bigger chunks from the files is anyways a good idea as specified by Anayonkar
Its difficult to tell what the issue is without knowing the environment of the server.
Connection refused error is thrown when the port is not open
Connection timeout error typically is thrown when the server is not able to respond to the client on time (one of the reasons is the request queue backlog as you mentioned)
5 years ago
I wonder why you would have to have a non blocking I/O or an event based server handler for a console as there will only be one client for this server side handler.
I can understand if you are re-directing multiple console inputs to a single server socket but in a scenario where there is one console to one server handler mapping, I am unable to understand the reasoning for an event based server.
If you are trying to have a single server processing model for both console & other socket input then I would say it is not worth in this usecase. After all there are many valid scenarios for blocking I/O anyways. NIO is not a replacement for blocking I/O

Anyways, java does not support registering an arbitrary stream to a selector. It has to be an implementation of a SelectableChannel which the InputStrem ( does not implement.
5 years ago
You need to give more details about your environment.
If it is a messaging system and the queue is ordered, then order of receiving can help you determine the sequence.
However, you should explain more about the intentions of this division (partition)
5 years ago
When you get a connection refused, you may want to telnet to the ip/port and see whether it is open. If it is not then its surely not a client problem.
It might be a problem of conflicting IPs in your network.
5 years ago
Why do you need to encrypt a hostname?
5 years ago
Well technically, for the remote object in question, the object becomes a remote object (i.e. the server) when it is exported & not when it is bound to a registry.
I will recommend to read sun RMI tutorials to understand the concepts.
5 years ago
You need to explain a little better about what you are trying to do, in order for anyone to help you.
5 years ago
I think the answer depends on the response content-type you want to have. If you are specifying application/json they you have to return a json string, so option c) is the correct choice. I am not sure what kind of data loss are you talking about in this case.
6 years ago
Hi Anitha,

By "implementing json" you mean how to create JSON objects? Easiest way is to use libraries like gson that auto converts a POJO to JSON.
Since, JSON objects can be read directly (by eval i guess, I am not a JS guru) in javascript I am not sure what you are specifically asking.
This isn't a distributed java question, moving to Ant forum.
6 years ago

Mustafa Dasorwala wrote:I am facing similar problem.

Please DontWakeTheZombies
6 years ago
This does not seem to be a problem specific to a product. It is an Null Pointer Exception because of wrong parameters or wrong logic.
If is your class then check out why is it creating an NPE, else see if it has some documentation about the parameters that it takes & are you passing some of them as null.

Moving to Java In General forum
6 years ago
It will be better to profile the JVM and find out what is taking memory, otherwise the memory leak is merely a speculation.
You can use jmap at the minimum to get a dump of the heap and later view it using jhat