You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Leo Li <li...@gmail.com> on 2006/08/10 04:52:59 UTC

[classlib][instrument]Method to terminate VM.

Hi, all
     During the implementaion of instrument, I encounter the choice about
how to terminate the VM when some abnormal event occurs, for example, the
expected jar file does not exist or the implementation class of
Instrumentation cannot be found. The most simple and direct way is just to
call exit(), and then the whole process will terminate. Hence OS will treat
with all the release of resources. However, I propose to use FatalError of
JNI instead, which notifies the VM to suicide, because it gives right to the
implementation of VM to take charge of its own funeral affairs, which might
include, for example, logging the cause of its crash.
    Any suggestion from VM guys?
    Thanks :)

-- 
Leo Li
China Software Development Lab, IBM

Re: [classlib][instrument]Method to terminate VM.

Posted by Tim Ellison <t....@gmail.com>.
Jimmy, Jing Lv wrote:
> Leo Li wrote:
>> Hi, all
>>     During the implementaion of instrument, I encounter the choice about
>> how to terminate the VM when some abnormal event occurs, for example, the
>> expected jar file does not exist or the implementation class of
>> Instrumentation cannot be found. The most simple and direct way is
>> just to
>> call exit(), and then the whole process will terminate. Hence OS will
>> treat
>> with all the release of resources. However, I propose to use
>> FatalError of
>> JNI instead, which notifies the VM to suicide, because it gives right
>> to the
>> implementation of VM to take charge of its own funeral affairs, which
>> might
>> include, for example, logging the cause of its crash.
>>    Any suggestion from VM guys?
>>    Thanks :)
>>
> 
> Hi,
> 
>     I agree that use VM FatalError is better than system exit(). If no
> objections, I will make code that way.
> 

Agreed, throw an error.

Regards,
Tim


-- 

Tim Ellison (t.p.ellison@gmail.com)
IBM Java technology centre, UK.

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: [classlib][instrument]Method to terminate VM.

Posted by Leo Li <li...@gmail.com>.
Hi, all
      The case is we need to load an implementation class during VM init and
should terminate it if the class cannot be found.
      Here is the code.

 inst_class =
(*env)->FindClass(env,
"org/apache/harmony/instrument/internal/InstrumentationImpl");
 if(NULL == inst_class){
  //VM exits abnormally.
  (*env)->FatalError(env,"class cannot find:
org/apache/harmony/instrument/internal/InstrumentationImpl");
 }

Thank you.

On 8/11/06, Geir Magnusson Jr <ge...@pobox.com> wrote:
>
> How far along is this code?  Any chance you want to toss up a snapshot
> of it so people can look and comment and ... maybe even help?
>
> geir
>
>
> Jimmy, Jing Lv wrote:
> > Leo Li wrote:
> >> Hi, all
> >>     During the implementaion of instrument, I encounter the choice
> about
> >> how to terminate the VM when some abnormal event occurs, for example,
> the
> >> expected jar file does not exist or the implementation class of
> >> Instrumentation cannot be found. The most simple and direct way is
> >> just to
> >> call exit(), and then the whole process will terminate. Hence OS will
> >> treat
> >> with all the release of resources. However, I propose to use
> >> FatalError of
> >> JNI instead, which notifies the VM to suicide, because it gives right
> >> to the
> >> implementation of VM to take charge of its own funeral affairs, which
> >> might
> >> include, for example, logging the cause of its crash.
> >>    Any suggestion from VM guys?
> >>    Thanks :)
> >>
> >
> > Hi,
> >
> >     I agree that use VM FatalError is better than system exit(). If no
> > objections, I will make code that way.
> >
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>


-- 
Leo Li
China Software Development Lab, IBM

Re: [classlib][instrument]Method to terminate VM.

Posted by Geir Magnusson Jr <ge...@pobox.com>.
How far along is this code?  Any chance you want to toss up a snapshot
of it so people can look and comment and ... maybe even help?

geir


Jimmy, Jing Lv wrote:
> Leo Li wrote:
>> Hi, all
>>     During the implementaion of instrument, I encounter the choice about
>> how to terminate the VM when some abnormal event occurs, for example, the
>> expected jar file does not exist or the implementation class of
>> Instrumentation cannot be found. The most simple and direct way is
>> just to
>> call exit(), and then the whole process will terminate. Hence OS will
>> treat
>> with all the release of resources. However, I propose to use
>> FatalError of
>> JNI instead, which notifies the VM to suicide, because it gives right
>> to the
>> implementation of VM to take charge of its own funeral affairs, which
>> might
>> include, for example, logging the cause of its crash.
>>    Any suggestion from VM guys?
>>    Thanks :)
>>
> 
> Hi,
> 
>     I agree that use VM FatalError is better than system exit(). If no
> objections, I will make code that way.
> 

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: [classlib][instrument]Method to terminate VM.

Posted by "Jimmy, Jing Lv" <fi...@gmail.com>.
Leo Li wrote:
> Hi, all
>     During the implementaion of instrument, I encounter the choice about
> how to terminate the VM when some abnormal event occurs, for example, the
> expected jar file does not exist or the implementation class of
> Instrumentation cannot be found. The most simple and direct way is just to
> call exit(), and then the whole process will terminate. Hence OS will treat
> with all the release of resources. However, I propose to use FatalError of
> JNI instead, which notifies the VM to suicide, because it gives right to 
> the
> implementation of VM to take charge of its own funeral affairs, which might
> include, for example, logging the cause of its crash.
>    Any suggestion from VM guys?
>    Thanks :)
> 

Hi,

     I agree that use VM FatalError is better than system exit(). If no 
objections, I will make code that way.

-- 

Best Regards!

Jimmy, Jing Lv
China Software Development Lab, IBM

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org