Determining which method to call from an array of Objects

Hi All,
Lets suppose I have an interface, a string method name, and an array of Objects indicating the parameters which should be passed to the method.
What Im trying to work out is a way to quickly determine which method should be invoked.
I can see that Class has getDeclaredMethod(String, Class[]), but that wont help me as I dont know the formal class types (the method may take X, but I might get passed Y which extends X in the array of objects).
Does anyone know of a quick way I can determine this?
All I can think of at the moment is going thru each method of the class one by one, and seeing if the arg is assignable, then, after getting all my matched methods, determining if there are any more 'specific' matches.
Any ideas?
Much appreciated,
Dave

you might want to take a look at the dynamic proxy apiCheers for the suggestion, but Im actually already using the dynamic proxy API.
What I have is a MockObjectValidator which allows mock objects to be configuered with expected calls, exceptions to throw etc etc.
I thought developers on my project would get tired using an interface like this:
myValidator.setExpectedCall("someMethod", new Class[] { typeA, typeB }, new Object[] { valueA, valueB} );
I.e, I wanted to cut out having to pass the class array, so they could just use:
myValidator.setExpectedCall("someMethod", new Object[] { valueA, valueB} );
The problem there is that I then need to pick the best Method from the class given the object arguments.
When the mock object is in use, its no problem as the InvocationHandler interface provides the Method. The problem I have is selecting what method a user is talking about from an array of Objects.
Ive written a simple one now, it just does primitive type class -> wrapper substitution, and then finds ** A ** match. If there is more than one match (ie, all params are assignable to a class' method params), I dont let that method be used.
Shortly I'll update it to actually make the correct selection in those cases.
cheers
Dave

Similar Messages

  • User exits which can be called from the bapi BAPI_ALM_ORDER_MAINTAIN

    Hi Experts,
    I was trying to change work orders using the BAPI_ALM_ORDER_MAINTAIN, but this does not allow me to update the order address, one way of updating the address is using recording, but i was looking for a way  in which we can use some user exit which will be called from the BAPI so that i can update the address number in the final structure before the work order is saved (without having to go for recording)?

    Hi,
    you have restrictions to this .
    Refurbishment orders are not supported.
    The estimated costs cannot be processed - only the estimated overall costs of the order.
    Notification data cannot be processed with the order BAPI, even if the settings in Customizing are such that the orders and notifications can be maintained on one screen. However, the system will create a notification with the order if this is specified in the Customizing settings.
    Permits cannot be processed.
    The order addresses cannot be processed.
    Individual partner addresses cannot be maintained.
    Regards

  • Object synchronization method was called from an unsynchronized block of co

    I have installed DotNETWebControlConsumer_3.0_sp1
    in my machine I am very much new to Plumtree
    I am building the application in vs 2005 or .Net 2.0 environment and plumtree 6.0
    here is my web.config file code
    <httpModules>
    <add type="Com.Plumtree.Remote.Loader.TransformerProxy, Plumtree.WCLoader, Version=3.0.0.0, Culture=neutral, PublicKeyToken=d0e882dd51ca12c5" name="PTWCFilterHttpModule"/>
    </httpModules>
    and I get the error Object synchronization method was called from an unsynchronized block of code
    I just removed the html format for posting purpose i mean all the less than and greater than sign
    please I need it so badly

    Regarding your first issue (because it looks as if you removed the <httpModules> node from your web.config to move on from that issue), I changed 'Aqualogic.WCLoader' to 'Plumtree.WCLoader' in <httpModules ../>, added a reference to Plumtree.WCLoader in my project , then added another <add assembly="Plumtree.WCLoaderyadayada...> accordingly to the <assemblies> node in the web.config and then it worked. Well, almost, now I'm seeing a new error:
    [NullReferenceException: Object reference not set to an instance of an object.]
    Com.Plumtree.Remote.Transformer.PTTransformer.HandleRequest(HttpContext ctx) in e:\buildroot\Release\wcfilter\3.0.x\filter\src\Com\Plumtree\Remote\Transformer\PTTransformer.cs:60
    Com.Plumtree.Remote.Transformer.PTTransformer.BeginRequestHandler(Object sender, EventArgs e) in e:\buildroot\Release\wcfilter\3.0.x\filter\src\Com\Plumtree\Remote\Transformer\PTTransformer.cs:54
    System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64
    Mine is a .net 2.0 portlet that will work if I don't try to use the WCC 3.0SP1 (by pulling the <httpModules> node. But then I'm guaranteed no inline refresh. I have no fix yet, but when I do, I'll post it. I've contacted Plumtree Support in the meantime because others must be having the same problem.
    p.s. Also using edk 5.3 signed, though I'm going to upgrade to 5.4 and see if that does anything.

  • How come property attribute of jsp:getProperty  knows which method to call

    Hello friends,
    I could not understand How come property attribute of <jsp:getProperty knows which method to call
    <jsp:useBean id="test" class="BeanTest.testing" scope="page" />
    <jsp:getProperty name="test" property="name" />
    there is no method "name" in testing.class file
    if u see the existing examples "date" given in TOMCAT , it is using many <jsp:getProperty tag, but the property name is not equal to the method method name in the Bean file
    thanks,

    First do you know what a
    bean property sheet is?
    If not say so.
    Second, to your question
    The Java Runtime Environment (JRE) uses introspection to identify the appropriate get() or set() methods of that bean. What is introspection?
    Introspection is a process that allows the class to expose its accessable variables and methods and allows other classes to see what they can do with that class when requested. Eg:
    public class MyBean{
    private String someValue = null;
    public MyBean(){
    someValue = "Some String Value";
    //Introspection will reveal this method
    public String getSomeValue(){
    return someValue;
    } and
    <jsp:getProperty name="...." property="someValue" />
    will call the getSomeValue() method

  • How to determine which CSQ a call is coming in from

    All,
    My understanding is that CAD should display what CSQ that an incoming call is coming from.  Should this be the case?  I have a customer that wants to answer calls differently based on which CSQ the call comes from.  I have two CSQ's created that are sharing the resource group and using the same skill. When a call comes in, it is not displaying the CSQ information.  Is there something I should look for to correct this?

    Yes, that is correct.  CAD will display in this order, the following:
    The Route Point
    The CSQ
    The Agent
    See this screenshot for an example.  If you do not see this data, it's possible the CAD client is in partial service, and troubleshooting will be needed.  However, this feature is there by default, and requires no additional work.
    Anthony Holloway
    Please use the star ratings to help drive great content to the top of searches.

  • Lookup the name of class where a methode is called from?

    Hi
    i have an object A and an object B. From A i call a methode in B and within that methode i need to find out ot which type the object is that called the methode.
    Is there any methode to find out which object is calling the methode and to find out of which class type that object is (resulting in a String containing the name of that class)?
    Thanks for your help.

    I can think of two ways to do this. First, you could get the current StackTrace and parse it up. You'd be looking for the stack trace element immediately before the current method is called if I understand your post correctly. If you are using JDK 1.3.1 or below, you'd have to print the StackTrace to a String. If you are using JDK 1.4, there is a new Object called StackTraceElement. You can get an array of them from an Exception object.
    Second, you could use AspectJ to crosscut code into your application. AspectJ is complicated so I will just point you to their website for more information: http://www.aspectj.org.
    Dave.

  • Determine where badi is called from : webshop, GUI or webUI

    Hi Experts,
    I am working on BADI com_partner_badi.
    I want to determine where this badi is being called from, ie, either from webshop, GUI or webUI in the ABAP debugger.
    Which parameter of the badi should i check , which will provide me with the calling application ?
    Thanks,
    Shantanu.
    Edited by: shantanu sardal on Mar 18, 2009 10:15 AM

    Hi Shantanu,
    Here is the explanation: The purpose of BADI is to enhance the functionality as per the customer needs. SAP has given the envelope in which you can write your own logic to change the SAP's standard behavior. Now the question that from where it gets triggered ?? It is not dependent on the GUI or Web UI etc , It can be triggered from any where as long as the component's code is getting triggered.
    For example You create a BP from GUI or from WebUI does not matters as underneath API's remains the same and  if you have a BADI implementation for the BP it will get triggered irrespective of the GUI or UI.
    Hope this will clear your doubt.
    Thanks,
    Vikash.

  • Determine which validation step called the user exit, possible?

    Hello all,
    We have a a validation with different steps that use the  same user exit in their respective check.
    My functional analyst asked me if there is a way to programmatically determine in the user exit which step is executing the user exit.
    So I am asking the same question here.
    As an example:
    Validation FI100 has step 001,  002, and 003.
    Each of these steps use the user exit U100 from module pool ZGGBR001 in their check.
    I haven't found a way in the code of U100 to determine which step called U100.
    Does anyone know if this can be done?
    I have used the following technique to get a variable from the program's call stack.
    data: var_name(30) type c value '(Z_CALLING)VARIABLE' .
    field-symbols: <fs> type any.
      assign (var_name) to <fs>.
      write: / 'Variable from Z_CALLING', <fs>.
    But I'm not sure how this might work with validation steps/user exits.
    Thanks
    Bruce

    Vinod,
    I did some debugging after I posted my question.  I came to the same solution, use FM 'SYSTEM_CALLSTACK'.
    VALCHCK_2FI100##001
    loop at i_callstack into w_callstack
                        where EVENTNAME+0(9) = 'VALCHCK_2'.
    FI110 is the validation
    001    is the step
    Thomas,
    Thanks for the caveats. 
    Bruce

  • I want to know why it's happening me this error: Object synchronization method was called from an unsynchronized block of code.

    I'm developing a Smart Array (it's a request I cannot use a List of int that I know it's easier because I made both codes). I have done this class and below is the example of how I use it. The error is often in this line (153 from class):
    // Ensure that the lock is released.
    Monitor.Exit(array);
    If I use a List nothing wrong happens just when I translate to an array. Thanks for your help.
    SmartArray3.cs
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading;
    using System.Threading.Tasks;
    namespace SmartArray
    class SmartArray3
    private int[] array;
    private int size = 0;
    private int count = 0;
    public SmartArray3()
    Resize(1);
    public SmartArray3(int size)
    this.size = size;
    array = new int[this.size];
    public bool Resize(int size)
    try
    if (array == null)
    array = new int[size];
    else
    Array.Resize(ref array, size);
    this.size++;
    return true;
    catch
    return false;
    private void add(int value)
    try
    if (array == null)
    this.size = 1;
    Resize(this.size);
    array[0] = value;
    this.count++;
    else
    if (this.count == (this.size - 1))
    this.size *= 2;
    this.Resize(this.size);
    if ((this.count - 1) < 0)
    array[0] = value;
    else
    array[this.count - 1] = value;
    this.count++;
    catch (Exception ex)
    Console.Write(ex.ToString());
    throw new System.IndexOutOfRangeException("Index out of Range.");
    // Lock the array and add an element.
    public void Add(int value)
    // Request the lock, and block until it is obtained.
    Monitor.Enter(array);
    try
    if (array == null)
    this.size = 1;
    Resize(this.size);
    array[0] = value;
    this.count++;
    else
    if (this.count == (this.size - 1))
    this.size *= 2;
    this.Resize(this.size);
    if ((this.count - 1) < 0)
    array[0] = value;
    else
    array[this.count - 1] = value;
    this.count++;
    finally
    // Ensure that the lock is released.
    Monitor.Exit(array);
    // Try to add an element to the List: Add the element to the List
    // only if the lock is immediately available.
    public bool TryAdd(int value)
    // Request the lock.
    if (Monitor.TryEnter(array))
    try
    if (array == null)
    this.size = 1;
    Resize(this.size);
    array[0] = value;
    this.count++;
    else
    if (this.count == (this.size - 1))
    this.size *= 2;
    this.Resize(this.size);
    if ((this.count - 1) < 0)
    array[0] = value;
    else
    array[this.count - 1] = value;
    this.count++;
    finally
    // Ensure that the lock is released.
    Monitor.Exit(array);
    return true;
    else
    return false;
    public int Get(int index)
    try
    return array[index];
    catch (IndexOutOfRangeException ex)
    throw new System.IndexOutOfRangeException("Index out of range");
    Code for called the Class:
    private static int threadsRunning = 0;
    private SmartArray3 sa = new SmartArray3();
    private List<double> times;
    private static string[] titles ={
    "Add ", "Add failed ", "TryAdd succeeded ", "TryAdd failed "};
    private static int[][] results = new int[3][];
    //Event to Create Threads
    private void newTest()
    for (int i = 0; i < 3; i++)
    Thread t = new Thread(ThreadProc);
    t.Start(i);
    Interlocked.Increment(ref threadsRunning);
    private void ThreadProc(object state)
    times = new List<double>();
    DateTime finish = DateTime.Now.AddSeconds(10);
    Random rand = new Random();
    int[] result = { 0, 0, 0, 0};
    int threadNum = (int)state;
    while (DateTime.Now < finish)
    Stopwatch sw = Stopwatch.StartNew();
    int what = rand.Next(250);
    int how = rand.Next(25);
    if (how < 16)
    try
    sa.Add(what);
    result[(int)ThreadResultIndex.AddCt] += 1;
    times.Add(sw.Elapsed.TotalMilliseconds);
    catch
    result[(int)ThreadResultIndex.AddFailCt] += 1;
    else
    if (sa.TryAdd(what))
    result[(int)ThreadResultIndex.TryAddSucceedCt] += 1;
    else
    result[(int)ThreadResultIndex.TryAddFailCt] += 1;
    sw.Stop();
    results[threadNum] = result;
    if (0 == Interlocked.Decrement(ref threadsRunning))
    StringBuilder sb = new StringBuilder(
    " Thread 1 Thread 2 Thread 3 Total\n");
    for (int row = 0; row < 4; row++)
    int total = 0;
    sb.Append(titles[row]);
    for (int col = 0; col < 3; col++)
    sb.Append(String.Format("{0,4} ", results[col][row]));
    total += results[col][row];
    sb.AppendLine(String.Format("{0,4} ", total));
    Console.WriteLine(sb.ToString());
    private enum ThreadResultIndex
    AddCt,
    AddFailCt,
    TryAddSucceedCt,
    TryAddFailCt
    Federico Navarrete

    The array that you're calling Monitor.Enter under is not always the same array that you call Monitor.Exit on. When you resize an array using Array.Resize, you pass the variable in as a reference parameter (ref). The method then creates a
    new array object and assigns it to the array variable. Then, when you leave the synchronization block after resizing the array, your Monitor.Exit uses the new array rather than the one it originally entered
    and... boom.
    Instead of locking on the array itself, create a new private readonly field of type Object called "lock" within the SmartArray class and use that to lock on. It doesn't
    need to be readonly, but the keyword will prevent you from accidentally introducing this issue again.

  • Conn Method Access - Calling from method

    Hi I am trying to create a method in another class to call another method that checks for userid in DB? What is the best way to set this up? I.e. calling method?
    //calling method below line
    private boolean setuserExist(String username) {
         else return false;
    public String getserExist() {
              return userexist;
    // Method being called below this line
    public boolean userExist(String username){
              boolean exist = false;
              System.out.println("in LoginDBAccess: username is " + username);
              try{
    Connection conn = dbc.getConnection();
    Statement statement = conn.createStatement();
    String query =      "SELECT User.UserID " +
                        "FROM User " +
                        "WHERE User.UserID = '" + username + "'";
    ResultSet resultSet = statement.executeQuery(query);
    System.out.println("1.1");
    ArrayList result = new ArrayList();
    while(resultSet.next()){
         //System.out.println("In While:");
    ArrayList item = new ArrayList();
    item.add(resultSet.getString("UserID"));
    result.add(item);
    System.out.println("LoginDBAccess Count: " + result.size());
    conn.close();
    if (result.size() == 1){
         exist = true;
              }catch(Exception e){
         e.printStackTrace();
              return exist;
         }

    http://forum.java.sun.com/thread.jspa?threadID=603496
    Cross-post.

  • Which method to call

    I have a web service that I created.
    In order to create webservice client, I used WSDL2JAVA utility - which in turn created the following classes -
    ListServiceSoapBindingStub.java
    ListServiceLocator.java
    ListServiceService.java
    ListService.java (originally created by me)
    What class/method do I call now to test if it works.
    I do not see the main method anywhere.
    Please suggest.

    You don't have any main method because these classes are thought to be used as interfaces to the Web Service. You have to create your own test class like (I guess):
    public class Tester {
      public static void main(String [] args) throws Exception {
        // Make a service
        ListServiceService service = new ListServiceLocator();
        // Now use the service to get a stub which implements the SDI.
        ListService port = service.getListService();
        // Make the actual call
       port.callYourMethod(....)
    }What method to call depends on what operations the service exports and which one you want to test!
    Perhaps if you give us more information (WSDL for instance) we can help you more...
    Look here: http://ws.apache.org/axis/java/user-guide.html#WSDL2JavaBuildingStubsSkeletonsAndDataTypesFromWSDL
    Cheers.

  • Printing a listing from an array of objects

    I know I'm missing something simple here but for the life of me I can't spot it. The code below should print a list of student names to the screen. At the moment it only prints the last name entered into the array. I will kick myself when I see the answer but can anyone suss this out ? Many thanks for any help.
    // A Program called StudentDetails3.java which inserts student names into an array according to
    // a calculated hash Index and then prints out the name list in this order
    import javax.swing.JOptionPane;
    public class StudentDetails3
    // Member Section
    // Private members
    private static String studentName;
    // Public members
    public static String input = JOptionPane.showInputDialog(" Please enter the number of students in the class : - ");
    public static int maxNum = Integer.parseInt(input);
    public static int hashIndex = 0;
    // Constructor Section
    StudentDetails3 ( String newStudentName )
    studentName = newStudentName.toUpperCase();
    // Method Section
    public int hashCalc()
    int total = 0;
    for( int charNo = 0; charNo < studentName.length(); charNo ++ )
    char letter = studentName.charAt(charNo);
    int asciiVal = letter;
         if( studentName.charAt(charNo) ==' ')
         asciiVal = 0;
         total = total + asciiVal;
    hashIndex = total % maxNum;
    return hashIndex;
    public void output()
    System.out.println(" The student's name and hash index is " + studentName + " " + hashIndex );
    static class DetailsStorage
    // Member Section containing the array into which the student objects will be inserted
    private Object [] array;
    private int current;
    // Constructor
    DetailsStorage ( int noOfStudents )
    array = new Object[ noOfStudents ];
    current = 0;
    // Method for adding name to array
    public void add ( Object StudentDetails3 )
    {  if ( array [ hashIndex] == null )
    array [ hashIndex ] = StudentDetails3;
    else if ( (hashIndex + 1) <= (array.length-1) )
    do
    { hashIndex = ( hashIndex + 1 );
         if ( array [ hashIndex ] == null )
         {   array [ hashIndex ] = StudentDetails3;
         break;
    } while ( (hashIndex + 1) <= (array.length-1) );
         else
              for ( int firstLp = 0; firstLp < array.length; firstLp ++ )
         if ( array [ firstLp ] == null )
         {   array [ firstLp ] = StudentDetails3;
                   break;
    public void printOut ( )
    {   int loop = 0;
    System.out.println ( " Name\t\tCourse " );
    System.out.println ( "____\t\t_________ " );
         for ( loop = 0; loop < array.length; loop ++ )
         System.out.println ( ( ( StudentDetails3 ) array [ loop ] ).studentName );
    // Main Program for testing
    public static void main( String[] args )
    {   String  name;                                              
    // Obtain list of names from the user
    DetailsStorage nameList = new DetailsStorage( maxNum );
    for( int lp = 0; lp < maxNum; lp++ )
    {   name =  JOptionPane.showInputDialog(" Please enter the name of student in full ( e.g. Gareth Edwards )");
    StudentDetails3 newDetails = new StudentDetails3( name );
    newDetails.hashCalc();
         nameList.add ( newDetails );
    newDetails.output();
    nameList.printOut();
    System.exit(0);
    }

    You've made the student name a static field, which means that there's only one for the whole class.
    So the last one you input is the one you use for everybody.

  • Finalize() method being called multiple times for same object?

    I got a dilly of a pickle here.
    Looks like according to the Tomcat output log file that the finalize method of class User is being called MANY more times than is being constructed.
    Here is the User class:
    package com.db.multi;
    import java.io.*;
    import com.db.ui.*;
    import java.util.*;
    * @author DBriscoe
    public class User implements Serializable {
        private String userName = null;
        private int score = 0;
        private SocketImage img = null;
        private boolean gflag = false;
        private Calendar timeStamp = Calendar.getInstance();
        private static int counter = 0;
        /** Creates a new instance of User */
        public User() { counter++;     
        public User(String userName) {
            this.userName = userName;
            counter++;
        public void setGflag(boolean gflag) {
            this.gflag = gflag;
        public boolean getGflag() {
            return gflag;
        public void setScore(int score) {
            this.score = score;
        public int getScore() {
            return score;
        public void setUserName(String userName) {
            this.userName = userName;
        public String getUserName() {
            return userName;
        public void setImage(SocketImage img) {
            this.img = img;
        public SocketImage getImage() {
            return img;
        public void setTimeStamp(Calendar c) {
            this.timeStamp = c;
        public Calendar getTimeStamp() {
            return this.timeStamp;
        public boolean equals(Object obj) {
            try {
                if (obj instanceof User) {
                    User comp = (User)obj;
                    return comp.getUserName().equals(userName);
                } else {
                    return false;
            } catch (NullPointerException npe) {
                return false;
        public void finalize() {
            if (userName != null && !userName.startsWith("OUTOFDATE"))
                System.out.println("User " + userName + " destroyed. " + counter);
        }As you can see...
    Every time a User object is created, a static counter variable is incremented and then when an object is destroyed it appends the current value of that static member to the Tomcat log file (via System.out.println being executed on server side).
    Below is the log file from an example run in my webapp.
    Dustin
    User Queue Empty, Adding User: com.db.multi.User@1a5af9f
    User Dustin destroyed. 0
    User Dustin destroyed. 0
    User Dustin destroyed. 0
    User Dustin destroyed. 0
    User Dustin destroyed. 0
    USER QUEUE: false
    INSIDE METHOD: false
    AFTER METHOD: false
    User Dustin destroyed. 1
    User Dustin destroyed. 1
    User Dustin destroyed. 1
    User Dustin destroyed. 1
    USER QUEUE: false
    INSIDE METHOD: false
    AFTER METHOD: false
    User Dustin destroyed. 2
    User Dustin destroyed. 2
    User Dustin destroyed. 2
    User Dustin destroyed. 2
    User Dustin destroyed. 2
    User Dustin destroyed. 2
    User Dustin destroyed. 2
    User Dustin destroyed. 2
    USER QUEUE: false
    INSIDE METHOD: false
    AFTER METHOD: false
    User Dustin destroyed. 3
    User Dustin destroyed. 3
    User Dustin destroyed. 3
    User Dustin destroyed. 3
    User Dustin destroyed. 3
    User Dustin destroyed. 3
    User Dustin destroyed. 3
    User Dustin destroyed. 3
    User Dustin destroyed. 3
    USER QUEUE: false
    INSIDE METHOD: false
    AFTER METHOD: false
    User Dustin destroyed. 4
    User Dustin destroyed. 4
    User Dustin destroyed. 4
    User Dustin destroyed. 4
    User Dustin destroyed. 4
    User Dustin destroyed. 4
    User Dustin destroyed. 4
    User Dustin destroyed. 4
    User Dustin destroyed. 4
    USER QUEUE: false
    INSIDE METHOD: false
    AFTER METHOD: false
    User Dustin destroyed. 5
    User Dustin destroyed. 5
    User Dustin destroyed. 5
    User Dustin destroyed. 5
    User Dustin destroyed. 5
    User Dustin destroyed. 5
    User Dustin destroyed. 5
    User Dustin destroyed. 5
    User Dustin destroyed. 5
    USER QUEUE: false
    INSIDE METHOD: false
    AFTER METHOD: false
    User Dustin destroyed. 6
    User Dustin destroyed. 6
    User Dustin destroyed. 6
    User Dustin destroyed. 6
    User Dustin destroyed. 6
    User Dustin destroyed. 6
    User Dustin destroyed. 6
    User Dustin destroyed. 6
    User Dustin destroyed. 6
    User Dustin destroyed. 6
    Joe
    USER QUEUE: false
    INSIDE METHOD: false
    AFTER METHOD: false
    User Dustin pulled from Queue, Game created: Joe
    User Already Placed: Dustin with Joe
    User Dustin destroyed. 7
    User Dustin destroyed. 7
    User Dustin destroyed. 7
    User Dustin destroyed. 7
    User Dustin destroyed. 7
    User Dustin destroyed. 7
    User Dustin destroyed. 7
    User Dustin destroyed. 7
    User Dustin destroyed. 7
    User Dustin destroyed. 7
    INSIDE METHOD: false
    INSIDE METHOD: false
    USER QUEUE: true
    INSIDE METHOD: false
    INSIDE METHOD: false
    User Dustin destroyed. 9
    User Joe destroyed. 9
    User Dustin destroyed. 9
    User Dustin destroyed. 9
    User Dustin destroyed. 9
    User Dustin destroyed. 9
    INSIDE METHOD: true
    INSIDE METHOD: false
    USER QUEUE: true
    INSIDE METHOD: false
    INSIDE METHOD: false
    INSIDE METHOD: true
    INSIDE METHOD: false
    USER QUEUE: true
    INSIDE METHOD: false
    INSIDE METHOD: false
    It really does seem to me like finalize is being called multiple times for the same object.
    That number should incremement for every instantiated User, and finalize can only be called once for each User object.
    I thought this was impossible?
    Any help is appreciated!

    Thanks...
    I am already thinking of ideas to limit the number of threads.
    Unfortunately there are two threads of execution in the servlet handler, one handles requests and the other parses the collection of User objects to check for out of date timestamps, and then eliminates them if they are out of date.
    The collection parsing thread is currently a javax.swing.Timer thread (Bad design I know...) so I believe that I can routinely check for timestamps in another way and fix that problem.
    Just found out too that Tomcat was throwing me a ConcurrentModificationException as well, which may help explain the slew of mysterious behavior from my servlet!
    The Timer thread has to go. I got to think of a better way to routinely weed out User objects from the collection.
    Or perhaps, maybe I can attempt to make it thread safe???
    Eg. make my User collection volatile?
    Any opinions on the best approach are well appreciated.

  • How to get string which is return from a method and method is called from a filter

    Can anyone please guide me how i will get a string on a template, this string value is return by method which is called through 'ValidateStandered' filter.
    My problem is when i CheckIn a document, i am implementing some validation of duplicated document and duplicated document is identified by some metadata value.
    if metadata value of CheckIn document(current document) is same with existing document then filter will return ddocname and ddoctitle of existing document on a template(user can see the ddocname of existing item).

    please find error logs also:
    intradoc.data.DataException: !csDbCouldNotBind,getValueOfDuplicateDocument
            at intradoc.jdbc.JdbcQueryUtils.buildQuery(JdbcQueryUtils.java:107)
            at intradoc.jdbc.JdbcWorkspace.buildQuery(JdbcWorkspace.java:736)
            at intradoc.jdbc.JdbcWorkspace.createResultSet(JdbcWorkspace.java:639)
            at CheckInRestrictionFilter.CheckInRestrictionFilter.getResultSet(CheckInRestrictionFilter.java:108)
            at CheckInRestrictionFilter.CheckInRestrictionFilter.doFilter(CheckInRestrictionFilter.java:57)
            at intradoc.shared.PluginFilters.filterWithAction(PluginFilters.java:114)
            at intradoc.shared.PluginFilters.filter(PluginFilters.java:68)
            at intradoc.server.DocServiceHandler.validateStandard(DocServiceHandler.java:1251)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at intradoc.common.IdcMethodHolder.invokeMethod(IdcMethodHolder.java:86)
            at intradoc.common.ClassHelperUtils.executeMethodReportStatus(ClassHelperUtils.java:324)
            at intradoc.server.ServiceHandler.executeAction(ServiceHandler.java:79)
            at intradoc.server.Service.doCodeEx(Service.java:620)
            at intradoc.server.Service.doCode(Service.java:592)
            at intradoc.server.ServiceRequestImplementor.doAction(ServiceRequestImplementor.java:1693)
            at intradoc.server.Service.doAction(Service.java:564)
            at intradoc.server.ServiceRequestImplementor.doActions(ServiceRequestImplementor.java:1483)
            at intradoc.server.Service.doActions(Service.java:559)
            at intradoc.server.ServiceRequestImplementor.executeSubServiceCode(ServiceRequestImplementor.java:1346)
            at intradoc.server.Service.executeSubServiceCode(Service.java:4109)
            at intradoc.server.ServiceRequestImplementor.executeServiceEx(ServiceRequestImplementor.java:1222)
            at intradoc.server.Service.executeServiceEx(Service.java:4104)
            at intradoc.server.Service.executeService(Service.java:4088)
            at intradoc.server.Service.doSubService(Service.java:3998)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at intradoc.common.IdcMethodHolder.invokeMethod(IdcMethodHolder.java:86)
            at intradoc.common.ClassHelperUtils.executeMethodEx(ClassHelperUtils.java:310)
            at intradoc.common.ClassHelperUtils.executeMethod(ClassHelperUtils.java:295)
            at intradoc.server.Service.doCodeEx(Service.java:637)
            at intradoc.server.Service.doCode(Service.java:592)
            at intradoc.server.ServiceRequestImplementor.doAction(ServiceRequestImplementor.java:1693)
            at intradoc.server.Service.doAction(Service.java:564)
            at intradoc.server.Service.doScriptableAction(Service.java:4050)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at intradoc.common.IdcMethodHolder.invokeMethod(IdcMethodHolder.java:86)
            at intradoc.common.ClassHelperUtils.executeMethodEx(ClassHelperUtils.java:310)
            at intradoc.common.ClassHelperUtils.executeMethod(ClassHelperUtils.java:295)
            at intradoc.server.Service.doCodeEx(Service.java:637)
            at intradoc.server.Service.doCode(Service.java:592)
            at intradoc.server.ServiceRequestImplementor.doAction(ServiceRequestImplementor.java:1693)
            at intradoc.server.Service.doAction(Service.java:564)
            at intradoc.server.ServiceRequestImplementor.doActions(ServiceRequestImplementor.java:1483)
            at intradoc.server.Service.doActions(Service.java:559)
            at intradoc.server.ServiceRequestImplementor.executeActions(ServiceRequestImplementor.java:1415)
            at intradoc.server.Service.executeActions(Service.java:545)
            at intradoc.server.ServiceRequestImplementor.doRequest(ServiceRequestImplementor.java:751)
            at intradoc.server.Service.doRequest(Service.java:1974)
            at intradoc.server.ServiceManager.processCommand(ServiceManager.java:486)
            at intradoc.server.IdcServerThread.processRequest(IdcServerThread.java:265)
            at intradoc.idcwls.IdcServletRequestUtils.doRequest(IdcServletRequestUtils.java:1355)
            at intradoc.idcwls.IdcServletRequestUtils.processFilterEvent(IdcServletRequestUtils.java:1732)
            at intradoc.idcwls.IdcIntegrateWrapper.processFilterEvent(IdcIntegrateWrapper.java:223)
            at sun.reflect.GeneratedMethodAccessor130.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at idcservlet.common.IdcMethodHolder.invokeMethod(IdcMethodHolder.java:87)
            at idcservlet.common.ClassHelperUtils.executeMethodEx(ClassHelperUtils.java:305)
            at idcservlet.common.ClassHelperUtils.executeMethodWithArgs(ClassHelperUtils.java:278)
            at idcservlet.ServletUtils.executeContentServerIntegrateMethodOnConfig(ServletUtils.java:1680)
            at idcservlet.IdcFilter.doFilter(IdcFilter.java:457)
            at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
            at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
            at java.security.AccessController.doPrivileged(Native Method)
            at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)
            at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)
            at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
            at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
            at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
            at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
            at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163)
            at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
            at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
            at java.security.AccessController.doPrivileged(Native Method)
            at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)
            at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)
            at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
            at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
            at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
            at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
            at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3739)
            at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3705)
            at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
            at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
            at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2282)
            at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2181)
            at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1491)
            at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
            at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

  • Help Determining Which Methods/Classes Are Being Used

    Hello,
    I'm having issues with my company's Java application and because I've luckily narrowed the classes down to a meager 30+ I need some help pinpointing my problem.
    I realize there are a lot of Java monitoring applets/applications and some are deployment-specific but I need something very detailed-- I haven't found the features I need.
    Specs:
    Jrun4, Java 1.4, Windows Server 2003
    I would like to have a monitor that tells me exactly (real-time) what classes, methods, variables, etc. are being called in real-time. Looking at the JRun launcher console for one process gives me this:
    Generating report:quadbase.reportdesigner.ReportAPI.QbReport with export type:PDF
    01/16 14:05:33 error Software caused connection abort: socket write error
    java.net.SocketException: Software caused connection abort: socket write error
            at java.net.SocketOutputStream.socketWrite0(Native Method)
            at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
            at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
            at jrun.servlet.io.MetricsOutputStream.write(MetricsOutputStream.java:75)
            at java.io.BufferedOutputStream.write(BufferedOutputStream.java:106)
            at jrun.servlet.http.WebOutputStream.write(WebOutputStream.java:64)
            at jrun.servlet.file.FileServlet.pipeData(FileServlet.java:419)
            at jrun.servlet.file.FileServlet.service(FileServlet.java:254)
            at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
            at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)This is cute, but not really helpful. I would like to determine what was passed to the process, from where and what went wrong.
    For example,
    Instead of this:
    Generating report:quadbase.reportdesigner.ReportAPI.QbReport with export type:PDF
    01/16 14:05:33 error Software caused connection abort: socket write errorI would get something like this:
    Generating report:quadbase.reportdesigner.ReportAPI.QbReport with export type:PDF
            Page variables: test.jsp ($var1= "I'm"; $var2= "Going"; $var3="To"; $var4="Break"; $var5 = null)
            Calling: test2.jsp
            With: jrun.bin.db.foo.Bar();
    01/16 14:05:33 error Software caused connection abort: socket write error
            Problem: $var5 = null;Sorry if I'm rambling, I just want to know what is where and who it's calling when it breaks. Then I could deduce which class, what variable, what page, etc. My application is very complicated and seemingly mundane changes can throw it all off.
    Any ideas?

    We'll look into usage tracking. We're on the standard edition, so I'm not sure if it's available. Also, some of these reports may be quarterly -- so there may be a long wait to see if the view is used and I need to know fairly soon. (If it's not used, it saves us some work in a project transition going on.)
    I certainly don't understand the underlying structure of the product, but it seems like there should be some way to determine if a view is used by a report. I apologize if I'm not using the correct terminology. Thanks for your help -- we'll keep looking into it.

Maybe you are looking for