Frank Sauer wrote:
> The reason I did't do that is because I read some strange
> rules in the EJB spec about bean instances getting discarded
> when checked exception are thrown. I probably totally
> misunderstood those rules, but I understood that there are
> lifecycle issues related to throwing the various kinds of
> exceptions.
There are, but the rules are different for system exceptions (e.g., Errors,
RuntimeExceptions, and checked Exceptions thrown in the Container internals)
and application exceptions (checked exceptions in the signature of a business
method in the Bean remote interface). For system exceptions the bean will be
discarded, but for applications exceptions it will not. So adding checked
exceptions is the right thing to do.
> RemoteException seemed to be the most convenient
> way to go. By the way, how does RMI get checked exceptions
> across the wire? I thought they were wrapped in the skeleton
> and unwrapped in the stub, hence my previous comment on wrapping
> exceptions in RemoteException.
Yes, checked exceptions are wrapped in RemoteExceptions by RMI, but they're
unwrapped and rethrown at the stub, so the client code can catch the checked
exception.
-----------------------------------------------------------------------------
"Writing a new object-oriented program sometimes feels a bit like
throwing a bunch of animals into a cage and watching what happens."
- Daniel Hillis in "The Pattern on the Stone"
-----------------------------------------------------------------------------
Bruce Cohen, | email: [EMAIL PROTECTED]
GemStone Systems, Inc. | phone: (503)533-3602
20575 NW Von Neumann Drive | fax: (503)629-8556
Beaverton, OR USA 97006 | web: http://www.gemstone.com
>
>
> Frank
>
> -----Original Message-----
> From: A mailing list for Enterprise JavaBeans development
> [mailto:[EMAIL PROTECTED]]On Behalf Of Rickard �berg
> Sent: Thursday, November 18, 1999 10:17 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Remote Interface Question
>
> Hi!
>
> Frank Sauer wrote:
> > You're right, it doesn't have to throw RemoteException, but it can't
> > throw any other exceptions either. I always thought (correct me if I'm
> > wrong) that the implementation could throw any exception which in turn
> > would get wrapped in a RemoteException for transport to the client. But
> > if my interface only specifies RemoteException, then that's the only one
> > I'm allowed to throw. Is that correct?
>
> That doesn't make much sense to me. Yes, if RemoteException is the only
> defined exception in a throws clause then that is the only type of
> exception that can be thrown.
>
> But, if you need application exception (=checked exceptions), why don't
> you simply add these to the throws clause in the remote interface?
>
> Interfaces is a means to define a contract. If you ignore that contract
> by throwing RemoteExceptions which wrap other exceptions you don't gain
> any extra information from the interface (as far as exceptions are
> concerned).
>
> Why would you want to have such a design/implementation??
>
> /Rickard
>
> --
> Rickard �berg
>
> @home: +46 13 177937
> Email: [EMAIL PROTECTED]
> Homepage: http://www-und.ida.liu.se/~ricob684
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff EJB-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff EJB-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".