who calls a method
Hello, is there a possibility to find out where a method has been called? Something like the information given by an exception. Thanks, Rapha -- procreo - Webseitenentwicklung und Individualsoftwarelösungen _ / __ / _/ __ / ___/ _/ / __ / procreo GbR / /_/ / / / /_/ / /__/ / / O__/ /_/ / Kochgasse 1 / /_/ /_//_/ /_/_/73630 Remshalden / /[EMAIL PROTECTED] /_/ http://www.procreo.de -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Environment
Hello again, is there a way to read the system-environmentvariables with JAVA? Thanks a lot, Rapha -- procreo - Webseitenentwicklung und Individualsoftwarelösungen _ / __ / _/ __ / ___/ _/ / __ / procreo GbR / /_/ / / / /_/ / /__/ / / O__/ /_/ / Kochgasse 1 / /_/ /_//_/ /_/_/73630 Remshalden / /[EMAIL PROTECTED] /_/ http://www.procreo.de -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: who calls a method
On Fri, Oct 12, 2001 at 03:08:46PM +0200, Raphael Mack wrote: > Hello, > > is there a possibility to find out where a method has been called? > Something like the information given by an exception. In the method add a call to Thread.dumpStack(); and you'll see the calling stack. regards, -- Sylvain. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: who calls a method
> Hello, > > is there a possibility to find out where a method has been called? > Something like the information given by an exception. > > Thanks, > Rapha Thread.dumpStack() -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Environment
On Fri, Oct 12, 2001 at 05:08:12PM +0200, Raphael Mack wrote: > Hello again, > > is there a way to read the system-environmentvariables with JAVA? If you mean the Unix/Linux environment - not without making JNI calls. If you can make JNI calls, the "getenv()" call will retrieve individual values and the global "environ" variable (man 5 environ) will let you find all of them. Nathan > > Thanks a lot, > Rapha > -- > procreo - Webseitenentwicklung und Individualsoftwarelösungen > _ > / __ / _/ __ / ___/ _/ / __ / procreo GbR >/ /_/ / / / /_/ / /__/ / / O__/ /_/ / Kochgasse 1 > / /_/ /_//_/ /_/_/73630 Remshalden > / /[EMAIL PROTECTED] > /_/ http://www.procreo.de > > > -- > To UNSUBSCRIBE, email to [EMAIL PROTECTED] > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] > -- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: who calls a method
On Fri, Oct 12, 2001 at 03:08:46PM +0200, Raphael Mack wrote: > Hello, > > is there a possibility to find out where a method has been called? > Something like the information given by an exception. Are you looking for a profiling tool to generate the information, or do you want to generate the information from within the method itself? If the latter, something like this will work: Exception e = new Exception(); e.fillInStackTrace(); e.printStackTrace(); Nathan > > Thanks, > Rapha > -- > procreo - Webseitenentwicklung und Individualsoftwarelösungen > _ > / __ / _/ __ / ___/ _/ / __ / procreo GbR >/ /_/ / / / /_/ / /__/ / / O__/ /_/ / Kochgasse 1 > / /_/ /_//_/ /_/_/73630 Remshalden > / /[EMAIL PROTECTED] > /_/ http://www.procreo.de > > > -- > To UNSUBSCRIBE, email to [EMAIL PROTECTED] > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] > -- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: who calls a method
At 8:55 AM -0700 10/12/01, Peter Graves wrote: > > is there a possibility to find out where a method has been called? = > >> Something like the information given by an exception. >> = > >> Thanks, >> Rapha > >Thread.dumpStack() Just to point out, the documentation specifically says: This method is used only for debugging. This means to not rely on the output of this in production code. Basically, if your code relies on this for its behavior, it's likely to break at some point. Different VMs will give different output anyway. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: who calls a method
On Fri, Oct 12, 2001 at 10:21:38AM -0700, Avi Cherry wrote: > At 8:55 AM -0700 10/12/01, Peter Graves wrote: > > > is there a possibility to find out where a method has been called? = > > > >> Something like the information given by an exception. > >> = > > > >> Thanks, > >> Rapha > > > >Thread.dumpStack() > > Just to point out, the documentation specifically says: > This method is used only for debugging. > > This means to not rely on the output of this in production code. > Basically, if your code relies on this for its behavior, it's likely > to break at some point. Different VMs will give different output > anyway. Yep... this is good for dumping info to be read by humans. If you want a data structure usable from software, you'll need to implement a profiler through the JVMPI interface. Nathan > > > -- > To UNSUBSCRIBE, email to [EMAIL PROTECTED] > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] > -- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: who calls a method
> Yep... this is good for dumping info to be read by humans. If you want a > data structure usable from software, you'll need to implement a profiler > through the JVMPI interface. OR maybe use those funky new JDK 1.4 APIs I noticed in the vicinity of the new Exeption.getCause() calls and stack backtrace facility. - Dave -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: who calls a method
|> Basically, if your code relies on this for its behavior, |> it's likely to break at some point. Different VMs will give |> different output anyway. | |Yep... this is good for dumping info to be read by humans. If |you want a data structure usable from software, you'll need to |implement a profiler through the JVMPI interface. The same caveat applies even with the JVMPI stuff; depending on the JVM, and particular optimizations you've performed you'll find that either the GetCallTrace interface function, or tracking you do based on METHOD_ENTRY and METHOD_EXIT events will give you results that may surprise you. Eg. either of those may indicate that you were called by foo even though foo never calls the method directly, if foo calls bar which calls you, and the JVM inlined bar into foo. If you really, really have to know who called you, the only failsafe way I can think of is to make the callers identify themselves when they call. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: who calls a method
>> Yep... this is good for dumping info to be read by humans. If you want a >> data structure usable from software, you'll need to implement a profiler >> through the JVMPI interface. > >OR maybe use those funky new JDK 1.4 APIs I noticed in the vicinity >of the new Exeption.getCause() calls and stack backtrace facility. Ah, this would be http://java.sun.com/j2se/1.4/docs/api/java/lang/Throwable.html#getStackTrace() Hooray! This would be great for log4j and other logging packages. [EMAIL PROTECTED] . . . .. . . . http://www.media.mit.edu/~nelson/ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]