Re: Socket factories with JERI
Mark Brouwer <[email protected]> Wed, 28 Nov 2007 19:57:44 +0100
| Newsgroups | gmane.comp.java.sun.jini |
|---|---|
| Message-ID | <[email protected]> |
Martin Cornelius wrote: > Hi there, > > i want to get a bit more control over read and write timeouts encountered in remote > calls on objects objects exported via JERI. I learned so far, that this should be possible > by creating my own Socket Factories and passing them to > net.jini.jeri.tcp.TcpServerEndpoint.getInstance() Hi Martin, For the connect timeout you can also use constraints, see the class level documentation net.jini.core.constraint.ConnectionRelativeTime. If you pass these in as part of the server constraints they will be 'enforced' by the Jini ERI proxy. As advise do it as a preference, that way the client is able to override it with a required connect timeout constraint. There is no equivalent for the read timeout for remote method invocations. IIRC the reason for not having a read timeout is due to the fact that in Jini ERI a socket connection can be reused for multiple invocations and the multiplexing protocol so that you can't have a 1:1 relation between the method constraints and the socket connection. But no doubt there are people who are in a far better position to explain the whys. There is a read time constraint though for unicast discovery, see com.sun.jini.discovery.UnicastSocketTimeout. Also it is rather tricky to have a read timeout, as it would place sort of an upper bound for the time a computation may take at the server side. Not that it shouldn't be handy to have a constraint to indicate the maximum time one is willing to spend waiting for a response, although a read timeout is not the proper mechanism for that, and I believe some people haven't made up their mind about whether such a constraint would be a good thing IIRC. But as you said it is possible to pass in a socket factory as part of the call to TcpServerEndpoint.getInstance, don't forget to make the socket factory class serializable and part of your download JAR file. And if secure communication is required you need to write a trust verifier for that socket factory and a bootstrap mechanism to get that trust verifier in a trusted way over the wire, so I hope the connect constraint will suit you. Personally I find the socket connect timeout rather essential, the read timeout scares me for remote method invocations. -- Mark -------------------------------------------------------------------------- Getting Started: http://www.jini.org/wiki/Category:Getting_Started Community Web Site: http://jini.org jini-users Archive: http://archives.java.sun.com/archives/jini-users.html Unsubscribing: email "signoff JINI-USERS" to [email protected]