How to find a caller of a method

hi all,
i have a method in a class and that method is being called from many different classes.
Inside that method , I want to know who is the caller of the method.
how can i find that. any help would be appreciated.
Thanks,
Dhanasekaran Vivekanandhan

look at the method Thread.currentThread.getStackTrace(), and the class StackTraceElement. you can work out the rest yourself, hopefully
but if your code depends on this knowledge, I reckon you've got design problems

Similar Messages

  • How to find the number of times method being called.....

    hi,
    can any one pls tell me how to find the number of times the method being called......herez the example....
    Refrence ref = new Refrence();
    for(int i = 0;i < arr.length; i++){
    if(somecondition){
    ref.getMethod();
    here i want to know how many times the getMethod() is calling...Is there any method to do this.. i have seen StrackTraceElement class..but not sure about that....pls tell me the solution....

    can any one pls tell me how to find the number of times the method being called......
    herez the example.... http://www.catb.org/~esr/faqs/smart-questions.html#writewell
    How To Ask Questions The Smart Way
    Eric Steven Raymond
    Rick Moen
    Write in clear, grammatical, correctly-spelled language
    We've found by experience that people who are careless and sloppy writers are usually also careless and sloppy at thinking and coding (often enough to bet on, anyway). Answering questions for careless and sloppy thinkers is not rewarding; we'd rather spend our time elsewhere.
    So expressing your question clearly and well is important. If you can't be bothered to do that, we can't be bothered to pay attention. Spend the extra effort to polish your language. It doesn't have to be stiff or formal ? in fact, hacker culture values informal, slangy and humorous language used with precision. But it has to be precise; there has to be some indication that you're thinking and paying attention.
    Spell, punctuate, and capitalize correctly. Don't confuse "its" with "it's", "loose" with "lose", or "discrete" with "discreet". Don't TYPE IN ALL CAPS; this is read as shouting and considered rude. (All-smalls is only slightly less annoying, as it's difficult to read. Alan Cox can get away with it, but you can't.)
    More generally, if you write like a semi-literate b o o b you will very likely be ignored. So don't use instant-messaging shortcuts. Spelling "you" as "u" makes you look like a semi-literate b o o b to save two entire keystrokes.

  • How to handle the call transaction in method of a custom business object

    Hello all,
    There is a custom report " RPTCORAPP" for approving leaves . As per my requirement i have develop a copy of leave workflow and for approval process i have call  "RPTCORAPP" in Custom method of custom object. i have made a transaction for this custom report for approving attendances. I am calling this method though call transaction statement within method.
    Problem: while approving the attendance workitem is not disappearing from the portal. Problem is due to call transaction statement.
                   once workitem come to the user, user click on it. control goes to the report, which display all the leave to approve on
                   the portal.
                   If after approving/ rejecting attendance user close the screen.workflow remain in the "process" status.Control wont come  back after call transaction statement in the method.
                 At the same time if user clicks on back button inspite of closing the screen. it is working fine. workitem disappears from the portal.
    How to handle the scenarion. if after approving/rejecting, i want the control to come back to the NEXT STATEMENT after call transactionstatement in my method.
    Please help it out........:)

    Hi swami,
    thanks for reply. but i am not using BDC in my method. iam just calling a custom transaction thriugh statement
    Call transaction 'ZHR_APPROVE_CLINOUT'. This transaction directly run the report RPTCORAPP and display all the request.

  • How to find a caller's Contacts information, from ...

    Every so often on my N8, I get a call from "someone".  All I see is the phone number, with no indication of who it's from.  Then I find out it's from someone who should have already been listed in my contacts.
    Is there any way to search through contacts by phone number?  At least that way I'd know who the call was from, before calling back.
    Also, is there anything to do (or not to do) that will minimize this problem?   I have multiple phone numbers and email addresses for several people, but I didn't think that would create an issue.

    How is Nokia Search Beta different from the "search" application I now have on my N8 after installing Anna?
    Let's say I'm in India, and my phone number is +91 12345 67890
    I might have written that as any of the following:
    +91 12345 67890
    +91 1234567890
    +911234567890
    1234567890
    Is there any search that will find the consecutive digits 12345 in ALL of the above? (Right now it "breaks" on the next-to-last example.
    Yes, if I have a number entered twice, this breaks the display of the name. How can I find any and all duplicate numbers stored in my contacts?
    If there was a way to search for any "string" of letters or numbers, that might eventually help me track things down a bit more quickly.

  • How to find out the value a method is returning using JDI

    Is it possible to find out what value (not simply the type) a method returns. I'd have thought there would be some access under MethodExitEvent but I can't find anything.

    Is it possible to find out what value (not simply the
    type) a method returns.There's currently no way to access a method's return value in
    method exit events
    This is Bug Id: 4195445
    Synopsis: JVMDI spec: Add return value to Method Exit Event
    http://developer.java.sun.com/developer/bugParade/bugs/4195445.html
    See also:
    http://developer.java.sun.com/developer/bugParade/bugs/4813046.html
    This will be fixed in the next major release of J2SE (code named 'tiger')

  • How to find the Feeder class behind Incident creation in SAP EHS?

    I have a requirement where i need to change the message text after clicking "Send" button while creating Incident.
    How to find the feeder class and method which is called behind "Send" button ?
    Thanks,
    Vimal

    I dont have such.. but you can set  external debug point in function module POWL_QUERY_REFRESH
    * get the result object type from the feeder
       lr_feeder->get_object_definition(
          EXPORTING
           i_selcrit_values = lt_crit_para  " selcrit dependent object def.
           i_langu = l_langu                                     "nt_1673495
           i_type  = i_query_data-type
          IMPORTING
           e_object_def = lr_object_def
    In I_QUERY_DATA-TYPE you can see name of POWL ID.
    Find it in transaction POWL_TYPE and you get name of feader class!

  • To find the Calling Program of an sap script

    Hi All,
    Can any body please let me know how to find the calling program ( main program ) of an SAP Script Form.
    Thanks and Regards,
    Rupesh

    Hi,
    if it's possible to create the form online (no background job), this works:
    From SE71 (Form painter), use menu Utilities-->activate debugger.
    Then start the program creating the SAPscript form.
    As soon as form processing starts, you are inside the SAPscript debugger. At this point, enter /h in command line to activate ABAP debugger. Continue to get into abap debugging. In ABAP debugger, use button 'calls' to see the call stack. The program at the bottom is the starting point, this or one of the more upwards program triggers the form.
    Hope this helps.
    regards,
    C.

  • How to find the lines where messages are raised?

    Hi experts,
    I have a great difficult to find some points where a message is raised.
    In GUI interface, we can use the u201CUsed-Listu201D option and the system show us the lines where the message is raised.
    In web-client, some good SAP programmers wrote the code u201Cif 1=2 message u2026u201D after he/she input message in the message manager classes (cl_bsp_wd_message_service, cl_crm_genil_global_mess_cont, etc). So the u201CUsed-Listu201D resource manages to find those points.
    However, some bad programmers didnu2019t do that and it is almost impossible to know where the message is raised in certain situation, though I have its message class name and its number, for instance, COM_PARTNER u2013 559.
    Is there any tip about how to find a calling point?
    Regards,
    André

    This will tell you the directory that contains the running program:
    System.getProperty("user.dir")

  • How to find out which class/method is calling System.gc

    Hi
    I am seeing frequent FULL GC and not able to locate which particular class/method is calling the System.gc(). I have disabled it using -XX:DisableExplicitGC and performance issues have been resolved. Also, I noticed that it does not happen periodically, so it is not RMI GC. How to find out who exactly is doing this? Does any of of the profilers like Optimizeit/Jprobe help find out this.
    Thanks

    Hi
    I am seeing frequent FULL GC This is because you are creating and destroying objects VERY frequently. Try to look at your design and see where you can reuse objects (i.e. object pooling) if possible, that is if this is adversely affecting performance.
    and not able to locate
    which particular class/method is calling the
    System.gc(). Classes don't call GC. The VM handles that automagically.
    I have disabled it using
    -XX:DisableExplicitGC and performance issues have
    been resolved. Also, I noticed that it does not
    happen periodically, so it is not RMI GC. How to find
    out who exactly is doing this? Does any of of the
    profilers like Optimizeit/Jprobe help find out this.OptimizeIt will tell you everything you need to know. However, NetBeans offers a free profiler now!

  • How to call a bean method from javascript event

    Hi,
    I could not find material on how to call a bean method from javascript, any help would be appreciated.
    Ralph

    Hi,
    Basically, I would like to call a method that I have written in the page java bean, or in the session bean, or application bean, or an external bean, from the javascript events (mouseover, on click, etc...) of a ui jsf component. I.e., I would like to take an action when a user clicks in a column in a datatable.
    Cheers,
    Ralph

  • How to call a bean method in the faces-config file?

    Hi,
    I would like in my menu to call the method of a bean (it initialize some properties before opening the page) instead of opening directly the page, by I can't find how to do that.
    I tried :
    <managed-property>
    <property-name>viewId</property-name>
    <value>#{listInformationsController.listInformations}</value>
    </managed-property>
    And :
    <managed-property>
    <property-name>outcome</property-name>
    <value>#{listInformationsController.listInformations}</value>
    </managed-property>
    With no success...
    Can someone help me?
    Thank you and merry christmas !

    Hi,
    a managed property only gives you a anlde to a bean or property, it doesn't execute it. To execute a bean, you can use a custom JSF PhaseListener that calls a bean method. The reference to the bean is achieve through value binding
    ValueBinding vb = FacesContect.getCurrentInstance().getApplication().createValueBinding("Name of Managed Bean);
    TypeOfBean theBean =(TypeOfBean) vb.getValue(FacesContext.getCurrentInstance());
    .... theBean.theMethod() ...
    Frank

  • How to call a Java method in a C consoleapplication?

    I have to call a void method of a javaclass using a c consoleapplication. No argument are passed to it.
    I can't make an object of that class..
    This is my implementation in c (using JNI):
    void update(void)
         classn = "<name>";
         cls = (*env) ->FindClass(env, classn );
         if (cls == 0)
    printf(" Can't find class %s\n", classn );
         mid =
    (*env)->GetMethodID(env, cls, "<methodname>", "()V");
         (*env)->CallVoidMethod(obj, env ,m id);
    This goes wrong...
    The problem is that I have no jobject (obj) of the class, because I don't want one...I don't need one. How can I call that void method without an object and only using the classname..??

    You have to make the java method a static method, and use CallStaticVoidMethod.
    "static" means that the method belongs to the class, and not an object of that class.

  • How to find out the calling point of a Badi

    Hi Experts,
    Say one Badi is getting called in a particular screen of a transaction.
    Can anyone please guide me how to find out the calling point for that Badi.
    I checked for transaction CC31 screen 2000, method IF_EX_ECM_EXIT~OMR_CHECK_01
    is getting called.
    But I could not find the calling point.
    Please help.
    Thanks,
    Sonali.

    Go in to the perticular method, and click on where used list.That may help.
    Or get into the method in debugging, and press F7. That will take you to the calling point.

  • How to call BOR object- method in custom program

    hi all,
    I have the following details:
    BOR object : INSTLN
    Method: createdirect
    I need to call the above method in my custom program.
    I need to call it entirely. Means if it contains fn modules I dont want to call those fn modules seperately.

    Hi Sammy,
    Phil Soady from SAP Australia provided me with this little gem a few years back. The actual documentation for this can be found somewhere in the workflow programming area, but I just looked and couldn't find it for you. Anyway, this is a sample program I built to show how to do this. In this example I call the Display method of the Sales Document BO.
    INCLUDE <cntn02>.
    INCLUDE <cntn03>.
    FUNCTION zcallbomethod.
    *"*"Local interface:
    * Data declaration
      DATA: vbak_ref TYPE swc_object.
    * Declare and initialise container
      swc_container container.
      swc_create_container container.
    * Create object reference to sales document
      swc_create_object vbak_ref 'VBAK' '0000000009'. "Sales Document Number
    * Call Display
      swc_call_method vbak_ref 'Display' container.
    * Error handling
      IF sy-subrc NE 0.
      ENDIF.
    ENDFUNCTION.
    Cheers
    Graham Robbo

  • Reg - how to find the purpose of methods in a class

    hi everyone,
               can u plz help me with how to find the purpose of methods in a class???????
    a description abt the methods in a class??????
                        thx in advance,
    regards,
    balaji.s

    Hi Balaji
    Pls find some stuff.
    reward pts if help.
    The following statements define the structure of a class:
    ·        A class contains components
    ·        Each component is assigned to a visibility section
    ·        Classes implement methods
    The following sections describe the structure of classes in more detail.
    Class Components
    The components of a class make up its contents. All components are declared in the declaration part of the class. The components define the attributes of the objects in a class. When you define the class, each component is assigned to one of the three visibility sections, which define the external interface of the class. All of the components of a class are visible within the class. All components are in the same namespace. This means that all components of the class must have names that are unique within the class.
    There are two kinds of components in a class - those that exist separately for each object in the class, and those that exist only once for the whole class, regardless of the number of instances. Instance-specific components are known as instance components. Components that are not instance-specific are called static components.
    In ABAP Objects, classes can define the following components. Since all components that you can declare in classes can also be declared in interfaces, the following descriptions apply equally to interfaces.
    Attributes
    Attributes are internal data fields within a class that can have any ABAP data type. The state of an object is determined by the contents of its attributes. One kind of attribute is the reference variable. Reference variables allow you to create and address objects. Reference variables can be defined in classes, allowing you to access objects from within a class.
    Instance Attributes
    The contents of instance attributes define the instance-specific state of an object. You declare them using the DATAstatement.
    Static Attributes
    The contents of static attributes define the state of the class that is valid for all instances of the class. Static attributes exist once for each class. You declare them using the CLASS-DATA statement. They are accessible for the entire runtime of the class.
    All of the objects in a class can access its static attributes. If you change a static attribute in an object, the change is visible in all other objects in the class.
    The technical properties of instance attributes belong to the static properties of a class. It is therefore possible to refer in a LIKE addition to the visible attributes of a class – through the class component selector or through reference variables, without prior creation of an object.
    Methods
    Methods are internal procedures in a class that define the behavior of an object. They can access all of the attributes of a class. This allows them to change the data content of an object. They also have a parameter interface, with which users can supply them with values when calling them, and receive values back from them The private attributes of a class can only be changed by methods in the same class.
    The definition and parameter interface of a method is similar to that of function modules. You define a method meth in the definition part of a class and implement it in the implementation part using the following processing block:
    METHOD meth.
    ENDMETHOD.
    You can declare local data types and objects in methods in the same way as in other ABAP procedures (subroutines and function modules). You call methods using the CALL METHOD statement.
    Instance Methods
    You declare instance methods using the METHODSstatement. They can access all of the attributes of a class, and can trigger all of the events of the class.
    Static Methods
    You declare static methods using the CLASS-METHODSstatement. They can only access static attributes and trigger static events.
    Special Methods
    As well as normal methods, which you call using CALL METHOD, there are two special methods called constructor and class_constructor that are automatically called when you create an object or when you first access the components of a class.
    reward pts if help.
    deepanker

Maybe you are looking for

  • Ibook screen cracked

    My husband's ibook screen cracked, we bought a VGA cable but cannot get into the system to have it recognize the new display. I have been able to bring up the system on my G4 tower by using a Firewire cable so I can see the system, I just don't know

  • Blank page printed every other sheet. Why? help!

    Our printer at our doctors office is a HP laserjet 2430tn with dual print capabilities, one for regular printing and one for scripts. Relevant to the scripts, every time a doctors send a prescription to the printer to be printed out, blank pages come

  • "DPM uses the Volume Shadow Copy Service (VSS)"

    "DPM uses the Volume Shadow Copy Service (VSS) to create a snapshot of the protected data." According to MS (http://technet.microsoft.com/en-us/library/bb808827.aspx) Does that mean  I have to set asides space on the protected server (a file server),

  • New GL Implementation

    We are planning to implement New GL within 7 months time. This will happen during the year of 2008, approximately June 2008. Our Fiscal year calendar start Jan 1 and end Dec 31. Is it possible of switching on the new GL on the middle of the year? As

  • I want to restore ipod (1st Clickwheel) but itunes says im not online

    I want to restore ipod (1st Clickwheel) but itunes says im not online so it does not let me do it, any suggestions..?