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

Lin Shen

Ranch Hand
+ Follow
since Oct 08, 2003
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 Lin Shen

same here.

but i thought it would be faster if java has support for this instead of invoking an external process.

also, i would like to know whether it is true that usually network latency is long if the hop count is greater?
Is it possible to count how many hops it takes to send a message to a distant node?
Hello, I tried to serialise Objects using ObjectOutputStream.writeObject. And got the output as bytes using the ByteArrayOutputStream. But I have found the bytes I got from the ByteArrayOutputStream is different to the output to a file on the harddisk using FileOutputStream.

And when I tried to retrieve the object from the bytes I got from the ByteArrayOutputStream. I got: invalid stream header when the bytes are sent accrossed the network and is about to be retrieved by a different node.

whereas I can successfully retrieve the object from the bytes written to the file using FileOutputStream.

So I am wondering how I can seriliaze objects to bytes and retrieves the bytes from another running program on another JVM. I am restricted to TCP connection and transporting data as bytes.
14 years ago

I have a problem with object serialization.

I have a remote object A which contains a vector. It implements remote interface C, which contains a single method that returns this vector to the client side. Class A also has a setVector method that allows a server side class B to update the vector content. So the client always gets a fresh copy of the vector modified by class B when it invokes the remote call.

Everthing goes well before class B calls the setVector method. However, after class B calls setVector method to update the vector, an exception is thrown when the client invoke the remote call. This exception says class B cannot be serialized. But I only return the vector that is modified by class B to the client side, not any instance of class B.

What is wrong with it? It works fine with CORBA. But why Java RMI doesnt like it?

15 years ago
That makes sense. Thanks very much for the advices.

I will put the problem on our wiki and ask the person who developed it to make the port configurable.

I am still not going to do it myself until the last minute.

Do I have to? I really dont wanna modify the code developed by someone else.

I thought multiple sockets can be binded to a single physical port. Doesnt Java support this?

for evaluation purpose, I will need to run multiple instances of my server program on a single physical machine. I got an Address Already in Use (the port is already in use?) for starting the 2nd instance of my server program.

The line that throws the exception is:

ss = ssf.createServerSocket(port);

I just wonder whether there is a way to allow any number of my server programs running on a single machine?

Thank you very much
Hi everybody,

I use Runtime class to start a new Process, which executes another Java program (starts a new main thread). Does each Java main thread run on a different JVM?

15 years ago
Hi, I want to dispatch a process, and later discard it if it could not complete process within the specified length of time. Can I use a daemon thread to count the time period? Or is there a better standard way to do it?

I had a looked at the util.Timer class. But it doesnt help.
15 years ago
Does Java support displaying the system information such as CPU model, CPU speed, cache size and etc.?

If so, which Java class support methods for doing this?

If not, any suggestions to extract system information on differnt OS using Java.
15 years ago
Hi, I want to write a program so that it only starts execution if there is no other user processes running. Otherwise, it should exit. Is it possibly to do so in Java?

16 years ago
OK, here is the answer I found myself.

Because IDL defines interfaces so strictly, the stub on the client side
has no trouble meshing perfectly with the skeleton on the server side.
Enve if the two are compiled into deffierennt programming languages, or
even running on different ORBs from different vendors.

Does anybody want to try it out?
16 years ago
Is it ture that client program and server program can be implemented in different languages?
16 years ago
You will need either stringified object reference (IOR string) or the string used to register the remote object to the NameService.
16 years ago
Thats exactly what I want. I will try that. Thanks