Originally posted by Duane Riech:
However RMI handles the communication back and
forth between the client/server, there has to be
SOME unique ID to identify who/whom to send each
packet to?
If RMI wants/doen't want to change threads to do
it fine. But there must be some unique tag.
The drawback here is that a RMI implementation could, arguably, be implemented that didn't use the same thread ID for locking that it did for locking. However, to my knowledge, this is a purely theoretical objection, since no such RMI actually does so.
Originally posted by Duane Riech:
First, I apologize for not getting this...
You first state that there's no guarantee that
the same thread will be used for a client, then
you state in a example to use Thread.currentThread()???
I've just done some testing using this call...
You don't get the same ID. So whether you use a
simple algorthim or a map or whatever, you can
never compare thread's to know when the correct
thread is requesting to unlock.
So I just don't see what the map does for me.
RMI is not thread safe? Fine, but never supplying
a tag for each client is communicating to....
That's odd.
Originally posted by Eugene Kononov:
In my tests, I conclusively proved that Sun's RMI is up to its specification, -- RMI runtime makes no guarantees with respect to mapping remote object invocations to threads.
Here is the output of my simple test (I can post the source if anyone interested), where I create 2 clients, and each client makes 10 invocations of the same method:
<snip>
[ March 09, 2003: Message edited by: Eugene Kononov ]
I'd very much like to see your tests, as opposed to just their output.
Just as I suspected, you're binding several threads to the very same object, thus bypassing the factory all together.
Originally posted by Eugene Kononov:
Oh, so you are saying,
"use the RMI factory, and use the thread as a client id?". But what's the point?
If I have a connection object from the factory, then that object itself identifies the client uniquely. I don't need any thread ids anymore!
The bottom line, again, is that RMI runtime makes no guarantees with respect to mapping remote object invocations to threads.
This is not just a theoretical argument from the RMI spec, but a very verifiable and practical one. I hope we aree on that.
Eugene.
The disadvantage here is that you risking an automatic failure, since you're not, by definition, implementing the methods lock(int) and unlock(int), but rather two different methods, with different signatures, that you find to be more convenient.
Free software is a matter of liberty, not price.
It seems that you will, in fact, need to modify the signature of the lock method, so that it can accept a client ID.
Free software is a matter of liberty, not price.
Max Habibi wrote:
Eugene,
You are correct, and I was mistaken. It is, in fact, possible for a single client, bound to a single remote instance, to have it's methods called by various threads. May I have some salt with my crow?
Max Habibi wrote:
However, not implementing the lock method in data seems a little drastic to me. Why not implement lock/unlock in the data class, and use delegation in RemoteData? That way, you're adhearing to the specs.
Raffe Paffe wrote:
Eugene , can you say that people have passed the exame without implementing anything in Data (lock/unlock)?
English is not my native language so i am unsure...Following is a description of the package that is provided, and of the extensions you are expected to implement.
[...]Part of your assignment will be to enhance the Data class. You may do this by modification or subclassing, but you should document the approach and reason for your choice.
Free software is a matter of liberty, not price.
English is not my native language so i am unsure...
Originally posted by Eugene Kononov:
[QB]
Yes, that seems like an obvious approach and that was how I designed it initially. However, that implies that locking will occur in non-networked mode.
Free software is a matter of liberty, not price.
Free software is a matter of liberty, not price.
public void lock(int record)
public void unlock(int record)
Record locking must be implemented using the methods public void lock(int)
and public void unlock(int)
Free software is a matter of liberty, not price.
Record locking must be implemented using the methods ....
Free software is a matter of liberty, not price.
Originally posted by Raffe Paffe:
Max, could you provide the example you were talking about?
Puh! This subject got me nervous! :-)
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |