Todd O'Bryan <email@hidden> writes:
> Any help appreciated, including advice about how I should really be
> doing this. I've thought about RMI, but I really need both the app
> and the server to be able to initiate contact, and from my quick
> perusal of RMI, it seems like all the remote objects have to live on
> one machine. I've also looked at the NIO package, but can't figure
you're wrong about RMI. there's no requirement at all that all
"servers" run on the same machine, although some network devices (NAT
firewalls, for example) can confuse it, and there is the problem of
obtaining the initial references to the remote objects. in fact, RMI
being a distrubited object system, it's easiest not to think in terms
of servers at all, but to continue (more or less) thinking in terms of
plain old objects.
I say "more or less" because designing and writing a distributed
system does need to be approached differently than writing either a
centralized system or a client-server type system. I've heard
people complain about the fact that all RMI remote calls need to
declare that they throw RemoteException, and that this screws up the
"transparency" they think they should be getting.
anyhow, while you can't (or shouldn't, anyhow) completely ignore the
fact that you've got a distributed system, you can get pretty close.
RMI takes care of a lot for you. distributed garbage collection, for
example. parameters and return values are automatically serialized
for you. also, if you pass a reference to a remote object, RMI will
automatically turn it into a remote refernce for you. so for example,
your clients (the side initiating the transaction) can regiter a
callback just as usual:
remoteObject.registerCallback(this);
and as long as you've done a few things (namely, exported "this" as a
remote object) the RMI runtime will replace the local reference "this"
with a remote reference. it's all very cool.
> out what it really gains me except the need to translate all my data
> objects into byte arrays so I can ship them back and forth. I don't
> really need non-blocking I/O (I don't think) because there isn't
> really much that either side of the connection can do while it's
> waiting for data from the other and I should never have more than 30
> people connected to the server at any one time.
you really should look at RMI. it sounds perfect for what you're
trying to do.
--
joe
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden
This email sent to email@hidden