Re: what is the importance of opnum parameter in invoke method.

Peter Jones <[email protected]> Mon, 25 Aug 2008 17:43:09 -0400
Newsgroups gmane.comp.java.sun.rmi
Message-ID <20080825214309.GA26910@east>
On Mon, Aug 25, 2008 at 02:43:33PM -0600, Abdullah Odeh Al-Zaghameem wrote:
> Hi all, I have implement a remote stub class manually without generating it by 
> rmic compiler, after then:
> 
> 1. is it a legal process to generate stubs manually??

It can work, although it's not clear why you need to do it.

Note that if all participating JVMs are using at least J2SE 5.0, you
don't need pre-generated stub classes, although to take advantage of
that option you would need to avoid using the single-argument
UnicastRemoteObject.exportObject method; see here for more details:

    http://archives.java.sun.com/cgi-bin/wa?A2=ind0501&L=rmi-users&P=556

> 2. if so, is there any importance for the opnum parameter in the invoke 
> method:
>       
>         invoke(Remote obj,
>               Method method,
>               Object[] params,
>               long opnum)
>               throws Exception

It identifies the remote method to be invoked (so it is quite
important!).  The formula for generating the value is described here:

    http://java.sun.com/javase/6/docs/platform/rmi/spec/rmi-stubs24.html

> 3. if i change this parameter and supply and random Long number!! what will 
> be the effects?

An exception like you reported in a previous message:

java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: 
    java.rmi.UnmarshalException: unrecognized method hash: method not supported by remote object

-- Peter

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff RMI-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

For a list of frequently asked RMI questions please refer to:
http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html

To view past RMI-USERS postings, please see:
http://archives.java.sun.com/archives/rmi-users.html