Re: Services and packaging dependencies

Gregg Wonderly <[email protected]>
Newsgroups gmane.comp.java.sun.jini
Message-ID <[email protected]>
Mark Brouwer wrote:
> Hi Patrick,
>
> Patrick Wright wrote:
>
>> We were asking ourselves the best policy/strategy in this case. Three
>> options came to mind
>> 1) Never pass any class over the wire that isn't your own, or isn't in
>> the JDK. That includes never wrapping exceptions that aren't your own.
>
> That is too rigorous but very safe, I would say never throw an exception
> over the wire for which you don't know what its content can be.

I think that Mark covered most of the issues.  In the service, I usually log the
message, and rethrow it, using the guidelines Mark outlined.  When it is an odd
exception, I will do what I think you discussed.  Mark's additional 'ticket'
addition would make it look like the following.

try {

} catch( NonSerializableException ex ) {
        Uuid id = UuidFactory.generate();
        log.log( Level.SEVERE, ex+": ticket="+id, ex );
        throw new MyRemoteWrapperException( ex.toString(), id );
}

Gregg Wonderly

--------------------------------------------------------------------------
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]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.