[NSNotificationCenter defaultCenter] selector method get called 2 times

i am sending NSSNotifcation to root view controller in iPhone app but its observer method getting notified two times how its possible can any one guide me
i have use this code to post notification in my detail view controllers which are going to get added in popover view
-(void) viewDidAppear:(BOOL)animated
    [super viewDidAppear:YES];
    [[NSNotificationCenter defaultCenter] postNotificationName:SetPopOverSizeNotification object: [NSNumber numberWithFloat:480]];
and added observer in my root view controller
- (void)viewDidLoad
    [super viewDidLoad];         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setPopoverSize:) name:SetPopOverSizeNotification object:nil];
the method implementation is as follows
#pragma mark - Popover Notification Method
- (void)setPopoverSize:(NSNotification *)notification
     NSNumber *height = (NSNumber *)notification.object;
      [myPopover setPopoverContentSize:CGSizeMake(320, [height floatValue]) animated:NO];
Also removing observer as follows
- (void)viewDidUnload {
    [super viewDidUnload];
    [[NSNotificationCenter defaultCenter] removeObserver:self name:SetPopOverSizeNotification object:nil];

Hi Saravanan,
I am  calling this component directly from my application. This component is not used anywhere. The component name is : ERC_C_REQ_MGMT_UI and the application name is: erc_a_req_mgmt
I am calling an application configuration ERC_A_REQ_MGMT to execute it.
Regards
Vishal Kapoor

Similar Messages

  • Action method getting called multiple times.

    Hi All,
    The problem that I am facing is pretty weird.
    The issue is the i have an input field that takes date as input field.
    This field is inside a data taable
    FYI: I tried converter still same problem.
    So when ever I enter wrong data as "asda" inside this date field I get a validation error. which is good. So assume it took me 3 submit clicks to fix all my errors on the page.
    So now when I click the submit for the 4th time.
    The action method gets trigerred 4 times.
    Desperately waiting for a fix.
    Thank you in advance.
                                            <h:dataTable id="disbursementTable"
                                                 value="#{certTemplateBean.disbursements}" var="disbursement"
                                                 binding="#{certTemplateBean.disbursementTable}"
                                                 columnClasses="disburseDate,disburseAmt,disburseAction"
                                                 styleClass="disbursementTable" cellspacing="0" cellpadding="1">
                                                 <h:column >
                                                      <h:inputText id="disburseDate" styleClass="#{certTemplatesListBean.errorHolder.disburseDate} ms" size="10"
                                                                value="#{disbursement.date}">
                                                           <f:validator validatorId="RegExp" />
                                                           <f:attribute name="regexp" value="[0-9]{2}/[0-9]{2}/[0-9]{4}" />                                             
                                                           <f:attribute name="fieldRef" value="Disbursement Date :" />
                                                           <f:attribute name="message" value="Invalid Date" />
                                                           <f:attribute name="bean" value="certTemplatesListBean" />
                                                      </h:inputText>
                                                 </h:column>
                                            </h:dataTable>
                                            <h:commandLink id="addPro"
                                                 action="#{certTemplatesListBean.doAddUpdateCertTemplate}">
                                                 <h:outputText value="Add Profile direct"/>
                                            </h:commandLink>

    Probably got to do with the JSF jar files. I am not sure though. Can you check if the below link is useful?
    http://jira.jboss.com/jira/browse/AJSF-127

  • CommandLink in dataTable rendered method is called multiple times

    I have a dataTable in which one of the columns contains a commandLink. The commandLink has the "rendered" option bound to a backing bean method. When the page is submitted, the backing bean method gets called 8 times for each row in the table if the value returned is "true" and 3 times per row if the value returned is "false". Since the page is designed to "navigate" back to itself, I can understand it getting called more than once, but 8 times??? What's up with that?

    Because you have a bug in your code.
    If you want further help post a Short, Self Contained, Compilable and Executable, Example Program ([url http://homepage1.nifty.com/algafield/sscce.html]SSCCE) that demonstrates the problem.
    And don't forget to use [url http://forum.java.sun.com/help.jspa?sec=formatting]code formatting when posting code.

  • Backing  Bean constructor getting called multiple times

    I have a List of records in the Table with a link Add.
    When i click Add i show a popup dialog which is attached to the dialogListener.
    On clicking OK on the dialog i want to add a record in the List in the backing Bean, but the Bean constructor is getting called multiple times.
    and the list to which the table is attached is also getting called multiple times.
    is there a way in which the method gets called only once?
    Message was edited by:
    user607056

    Hi!
    af:table have property ContentDelivery. When <default> (lazy), the table "frame" iz rendered in first page cycle, and content (rows in table) are fetched lazy i.e. in second cycle. Thus, your backing bean is constructed twice.
    If you set ContentDelivery to immediate, the table including data rows is generated in single page cycle thus your backing bean is constructed only once.
    Hope this helps,
    PaKo

  • ValidateEntity getting called multiple times

    Hi,
    There is a parent EO and a child EO. There is a composite association between the parent and child.Association accessors are generated for both source and destination. In the ChildEO's doDML method , the following code is added.
    Long abc = getPArentEO().getAttr1();
    Long xyz = getPArentEO().getAttr2();
    setAttr3(abc);
    setAttr4(xyz);
    super.doDML();
    getParentEO() is the association accessor .
    After the addition of this code, all the method validators of the parent are getting fired more than once. The validateEntity of the parentEO is getting called more than once if I set some attribute of the childEO in childEO's doDML . Is this the expected behaviour?
    Thanks.

    Even on adding the setter in prepareForDML (either in parent or child) , the validateEntity is getting called multiple times. In fact ,validateEntity is getting called once before prepareForDML and again after. One of my method validators fail on the subsequent call giving an error ..Please help.

  • DataAction prepareModel method getting called twice.

    I have a DataAction subclass in which I have overridden the prepareModel() method, putting a System.out.println() into. I just discovered that this method is getting called twice per time that I run the DataAction. Why is this, and how do I change it so that it is only executed once?
    Brad

    Hi:
    The prepareModel method will get called each time your action is executed, ie before your page is displayed, and after a user submits a request.
    If you dont want your code in the prepareModel method to be run when a user submits a request, you should check the event list. If the list is non-empty, then the user has submitted a request to your action.
    The following code is taken from Steve Muench's ADFToyStore demo:
    private boolean handlingEvents(DataActionContext ctx) {
        List events = ctx.getEvents();
        return (events != null) && (events.size > 0);
    }in your prepareModel method, do the following:
    protected void prepareModel(DataActionContext ctx) {
        if(!handlingEvents(ctx)) {
            // code for before the initial display of the page
        } else {
            // code to be executed before your event handlers get called
    }HTH
    Gareth

  • Php include file getting called multiple times

    I have created a form in file career.php. To carry out the validation user_registration.php is called at the beginning of the file.
    user_registration.php in turn calls library.php. Issue is that library.php is getting called multiple times.
    I have attached phperror.log which confirms the same.
    career.php
    <?php
    session_start();
    require_once('phpScript/user_registration.php');
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    user_registration.php
    <?php // This file is used for validating user form data. It calls process_upload.php to validate file uploaded by user
    $errors = array();  
    $messages = array();
    $testing = TRUE;
    error_log("Enter- user_registration.php. Testing mode $testing", 0);
    try {
              error_log("user_registration.php: Entered try catch block",0);
    require_once('library.php');
              error_log("Successfully called library.php",0);
              $public_key = '6LeDsNUSAAAAAIoaYuNhGm2zx_qgBECiybUWUkt6';
              $private_key = '6LeDsNUSAAAAACuvmJrec-_5seLdmhqUMngt8AiU';
              $recaptcha = new Zend_Service_ReCaptcha($public_key, $private_key);
              if(isset($_POST['submit'])) {          // Only execute if form is submitted by user
                error_log("user_registration.php. Submit button pressed by user", 0);
                require_once('Zend/Mail.php');
                $mail = new Zend_Mail('UTF-8');
                if (isset($_POST['name'])) {
                        $val = new Zend_Validate_Regex('/^\p{L}+[-\'\p{L} ]+$/u');
                        if (!$val->isValid($_POST['name'])) {
                          $errors['name'] = "Please enter your name, no numbers permitted";
    error_log("Exit- user_registration.php.", 0);
    library.php
    <?php
    error_log("Enter- library.php. Testing mode $testing", 0);
    if ($testing)  // If true then go to testing mode
              $library = '/Applications/MAMP/htdocs/mgtools-india/ZendFramework/library';
              set_include_path(get_include_path() . PATH_SEPARATOR . $library);
    require_once('Zend/Loader/Autoloader.php');
    try {
    Zend_Loader_Autoloader::getInstance();
    error_log("Exit- library.php. Testing mode $testing", 0);
    phperror.log
    Marker - 12-Oct-2012 10:27:26 AM
    [12-Oct-2012 04:57:33 UTC] Enter- user_registration.php. Testing mode 1
    [12-Oct-2012 04:57:33 UTC] user_registration.php: Entered try catch block
    [12-Oct-2012 04:57:33 UTC] Enter- library.php. Testing mode 1
    [12-Oct-2012 04:57:33 UTC] Exit- library.php. Testing mode 1
    [12-Oct-2012 04:57:33 UTC] Successfully called library.php
    [12-Oct-2012 04:57:36 UTC] Enter- user_registration.php. Testing mode 1
    [12-Oct-2012 04:57:36 UTC] Entered try catch block
    [12-Oct-2012 04:57:36 UTC] Enter- library.php. Testing mode 1
    [12-Oct-2012 04:57:36 UTC] Exit- library.php. Testing mode 1
    [12-Oct-2012 04:57:36 UTC] Successfully called library.php
    [12-Oct-2012 04:58:38 UTC] Enter- user_registration.php. Testing mode 1
    [12-Oct-2012 04:58:38 UTC] Entered try catch block
    [12-Oct-2012 04:58:38 UTC] Enter- library.php. Testing mode 1
    [12-Oct-2012 04:58:38 UTC] Exit- library.php. Testing mode 1
    [12-Oct-2012 04:58:38 UTC] Successfully called library.php
    [12-Oct-2012 04:58:38 UTC] user_registration.php. Submit button pressed by user
    [12-Oct-2012 04:58:39 UTC] user_registration.php, Processing enquiry form
    [12-Oct-2012 04:58:39 UTC] Enter- process_upload.php. Testing mode 1
    [12-Oct-2012 04:59:01 UTC] Exit- user_registration.php.
    I am not able to understand why user_registration.php and library.php are executing again and again.
    I ran this test on local testing server MAMP.
    The results are the same on remote server also.
    Please guide.

    I'm not sure what's happening there. The important question is whether the code is executed successfully.
    Since you're using the Zend Framework, it might be better to ask in a dedicated ZF forum.

  • How and when the realDelete method gets called for a custom adapter?

    Hi,
    I am a newbie in sun identity manager and is in the process of writing a custom adapter for documentum resource.
    While I am successful in creating the resource,then provisioning the resource to an user(i.e creating an account of the user on documentum ) updating the user through idm I am not being able to deprovision the resource.
    Actually in the trace I am not seeing the realDelete method getting called anywhere,but I am sure if it gets called it would do its designated job bcos as a standalone code it's working.
    Does this mean I am not properly doing deprovisioning in sun-idm?
    What method I am employing is in the assignment list of the user,i am putting the resource from assigned to unassigned side(i.e right to left side) just as in case of provisioning I have put it from left to right.
    Is it the standard way of deprovisioning or am I missing something here?
    Any sort of help would be highly appreciated.
    Thanks
    anjan

    You need to read that manual with more caution. It has all info you need.
    1. Table modification info stays in shared pool and flushed into dictionary by Oracle automatically. You can explicity do it by calling dbms_stats.flush_database_monitoring_info.
    2. dba_tab_modifications view = How many DML are applied to target table?
    dba_tab_statistics.stale_stats = Is statistics stale?
    3. When you call dbms_stats.gather... familiy, Oracle flushed the stale info to disk. You gnerally don't need to care about that.
    4. Statistics is considered to be stale, when the change is over 10% of current rows.
    (As of 11g, this value can be customized per objects. Cool feature)
    create table t_stat(id int);
    insert into t_stat select rownum from all_objects where rownum <= 100;
    commit;
    exec dbms_stats.gather_table_stats(user, 'T_STAT');
    select * from sys.dba_tab_modifications where table_name = 'T_STAT';
    No row selected
    select stale_stats from sys.dba_tab_statistics where table_name = 'T_STAT';
    NO
    insert into t_stat select rownum from all_objects where rownum <= 20;
    select * from sys.dba_tab_modifications where table_name = 'T_STAT';
    No rows selected <-- Oops
    select stale_stats from sys.dba_tab_statistics where table_name = 'T_STAT';
    NO  <-- Oops
    exec dbms_stats.flush_database_monitoring_info;
    select * from sys.dba_tab_modifications where table_name = 'T_STAT';
    TABLE_OWNER     TABLE_NAME     PARTITION_NAME     SUBPARTITION_NAME     INSERTS     UPDATES     DELETES     TIMESTAMP     TRUNCATED     DROP_SEGMENTS
    UKJA     T_STAT               20     0     0     2008-01-18 PM 11:30:19     NO     0
    select stale_stats from sys.dba_tab_statistics where table_name = 'T_STAT';
    YES

  • Validation Event getting called multiple times

    I am saving an eform after entering a wrong percentage in it.On opening the same eform it gives the validate message "Percentage not valid" pop up .This popup should come only once but its coming around 25-26 times.I checked and find that the validate event is getting called multiple times for the same field.Can someone tell why this is happening and how to resolve this

    Hi rupali Sri,
    Our forum here is for questions related to the LiveCycle Collaboration Service product.
    You might want to post your question to the Livecycle Forms forum:
    http://forums.adobe.com/community/livecycle/livecycle_es/forms_es
    If that's not the correct forum, start from here:
    http://forums.adobe.com/index.jspa?view=overview
    Hope this helps.
    Good luck,
    Julien
    LCCS Quality Engineering

  • Validators getting called multiple times?

    I am working on a project where were we have used BackingBean validators for an input text component.
    When I first submit, the validator method getting called once, when I submit again, its getting called twice, and it goes on. After clearing the session, the validator getting called once, then twice, ...
    I don't know why this happens. Can any help me with this? What could be reasons for this weird behavior? What might went wrong in our code.

    An SSCCE please.

  • Problem adding listners(getting called multiple times)??

    Hi
    I got a small doubt,
    If I have two radio buttons, if I implement item listeners on that two radio buttons ,
    Depending on the value I get from the database I set it to be selected , but the question is why is the item listener called many times when I write
    This code is written in one item listener --universal radio button.
    Universalbtn.addItemListener(new ItemListener()
    Public itemStateChange(){
    //Some processing from the database
    if(type=�P�)
    Partialbtn.setSelected(true);
    Else if (type=�S�)
    Sparebtn.setSelected(true);
    )Here�s the exact code �
    objUniversalRadBtn.addItemListener(new ItemListener() {
                                        public void itemStateChanged(ItemEvent iE) {
                                                    arrStoreFamilyList=new ArrayList();
                                                    ArrayList arrResults=null;
                                                    arrStoreFamilyList.add(FLAG_RADIO_BTN);
                                                    try {
                                                                //calling the service, to store the values selected or entered in UI.
                                                                arrResults=(ArrayList)objController.doAction
                                                                                                                ("admininvmgmnt.service", arrStoreFamilyList);
                                                    catch(EnPVException enPV) {
                                                                logger.error("exception"+enPV);
                                                    if(arrResults.get(0).equals(BOOLEAN_VALUE)) {
                                                                objMessageUI=new MessageUI();
                                                                objMessageUI.infoMessage(INVENTORY_CYCLE_INPROGRESS);
                                                                if(strInvType.equals(INVENTORYTYPE_PARTIAL)) {
                                                                            objPartialRadBtn.setSelected(true);
                                                                }else {
                                                                            objSpareRadBtn.setSelected(true);
                                                    }else {
                                                    objAddedFamilyList.setEnabled(false);
                                                    objFamilyName.setEnabled(false);
                                                    objFamilyTxt.setEnabled(false);
                                                    objAddBtn.setEnabled(false);
                                                    objRemoveBtn.setEnabled(false);
                                                    objInvMgmtUI=null;
                            objSpareRadBtn.addItemListener(new ItemListener() {
                                        public void itemStateChanged(ItemEvent iE) {
                                                    arrStoreFamilyList=new ArrayList();
                                                    ArrayList arrResults=null;
                                                    arrStoreFamilyList.add(FLAG_RADIO_BTN);
                                                    try {
                                                                //calling the service, to store the values selected or entered in UI.
                                                                arrResults=(ArrayList)objController.doAction
                                                                                                                ("admininvmgmnt.service", arrStoreFamilyList);
                                                    catch(EnPVException enPV) {
                                                                logger.error("exception"+enPV);
                                                    if(arrResults.get(0).equals(BOOLEAN_VALUE)) {
                                                                objMessageUI=new MessageUI();
                                                                objMessageUI.infoMessage(INVENTORY_CYCLE_INPROGRESS);
                                                                System.out.println(strInvType);
                                                                if(strInvType.equals(INVENTORYTYPE_UNIVERSAL)) {
                                                                            bFlag=false;
                                                                            objUniversalRadBtn.setSelected(true);
                                                                }else if(strInvType.equals(INVENTORYTYPE_PARTIAL)) {
                                                                            objPartialRadBtn.setSelected(true);
                                                    }else {
                                                    objAddedFamilyList.setEnabled(false);
                                                    objFamilyName.setEnabled(false);
                                                    objFamilyTxt.setEnabled(false);
                                                    objAddBtn.setEnabled(false);
                                                    objRemoveBtn.setEnabled(false);
                                                    objInvMgmtUI=null;
                            });Pls kindly , let me know why is this happening , as I had overcomed this problem many times and I changed my code when this happened with the textfields in some cases � (when I wrote focuslost events on textboxes , the same case happened �calling the other listener many times and then the cursor got focused in the textfield)
    thnx & regards
    Neel

    Inside the Method itemStateChanged() dont use
    objPartialRadBtn.setSelected() or objSpareRadBtn.setSelected()
    If you still want to use then do
    objPartialRadBtn.removeItemListener(...);
    objPartialRadBtn.setSelected();
    objPartialRadBtn.addItemListener(...);

  • DoGet method is called 2 times when a switch-case statement is used

    Hello all,
    I have a servlet that, when run from browser, runs the doGet method 2 times.
    I have a switch case statement within the servlet and when I comment out this servlet, it runs 1 time as expected.
    Here is the code:
    public class RSSServlet extends HttpServlet {
        /** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
         * @param request servlet request
         * @param response servlet response
        protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            System.out.println("CALLED SERVLET");
            response.setContentType("text/xml;charset=UTF-8");
            PrintWriter out      = response.getWriter();
            DBQueriesRSS queries = new DBQueriesRSS();
            String queryType     = request.getParameter("queryType");
            String strCount      = request.getParameter("count");
            int count            = (strCount != null && !strCount.equalsIgnoreCase("null") && strCount.length() > 0) ?
                Integer.parseInt(strCount) : 25;
             if(queryType != null && !queryType.equalsIgnoreCase("null") && queryType.length() > 0) {
                System.out.println("IN IF STATEMENT");
                switch(Integer.parseInt(queryType)) {
                    case 1 : out.println(queries.getDefault(count));System.out.println("1");       break;
                    case 11: out.println(queries.getDefault(count));System.out.println("11");       break;
                    case 21: out.println(queries.getTopDaily(count));System.out.println("21");      break;
                    case 22: out.println(queries.getTopWeekly(count));System.out.println("22");     break;
                    case 23: out.println(queries.getTopMonthly(count));System.out.println("23");    break;
                    case 24: out.println(queries.getTopYearly(count));System.out.println("24");     break;
                    case 31: out.println(queries.getTopNDailyBW(count));System.out.println("31");   break;
                    case 32: out.println(queries.getTopNWeeklyBW(count));System.out.println("32");  break;
                    case 33: out.println(queries.getTopNMonthlyBW(count));System.out.println("33"); break;
                    case 34: out.println(queries.getTopNYearlyBW(count));System.out.println("34");  break;
                    default: out.println(queries.getTopWeekly(25));System.out.println("default");    break;
                System.out.println("OUT OF SWITCH");
            System.out.println("OUT OF IF");
            out.close();
        // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
        /** Handles the HTTP <code>GET</code> method.
         * @param request servlet request
         * @param response servlet response
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            processRequest(request, response);
        /** Handles the HTTP <code>POST</code> method.
         * @param request servlet request
         * @param response servlet response
        protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
           processRequest(request, response);
        /** Returns a short description of the servlet.
        public String getServletInfo() {
            return "Short description";
        // </editor-fold>
    } The results from running this servlet are:
    http://localhost/proxy/RSSServlet??queryType=34&count=66
    CALLED SERVLET
    IN IF STATEMENT
    34
    OUT OF SWITCH
    OUT OF IF
    CALLED SERVLET
    IN IF STATEMENT
    34
    OUT OF SWITCH
    OUT OF IFAnyone see anything obvious?
    TIA!

    in your case you want 'count' to be a class attribute rather than a local variable. But yes, incrementing it each time that the method is called will serve your purpose.

  • EjbActivate() and ejbPassivate() methods are called million times!!! :(

    Hello All,
    Am I missing some thing here?
    We have a project with many Entity Beans, and all of them have relations with one another. The simple example I can give is Entity A has one to many relation with Entity B.
    i.e There could be one Entity A and for this there could be many Entities B these two entities are managed by CMR fields.
    Entity A has a PK, this would act as a FK in Entity B.
    In the EJB Post create method of Entity B I am trying to find a suitable entity A and trying to execute setEntityA(suitableEntityA), while this method is getting executed here is the things that happen
    the container tries to find all Entity B (if there are 10,000 records in B table then ejbActivate() of B is executed 10,000 times) then it sets the relation with Entity A, then at the end of the Transaction the container will call ejbPassivate() method on Entity B 10,000 times!!! oh god what is happening here...!!!?????
    can some one tell me if I am missing some settings?
    The same thing happends for all the other EJBs which have one to many CMR fields, i.e ejbActivate() and ejbPassivate() of each of these Entity Beans will be called for those many number of times for as many records found in the Datbase of the corresponding Entity.
    I have the follwing setting in my orion-ejb-jar.xml file
    <entity-deployment name="EntityA"
    max-tx-retries="0"
    max-instances="-1"
    location="EntityA"
    table="A"
    data-source="jdbc/oracleDS"
    exclusive-write-access="false"
    locking-mode="optimistic"
    update-changed-fields-only="true"
    delay-updates-until-commit="true">
    similar xml construct for Entity B also!!!
    If some one knows more about this please let me know.
    Thank you
    -Mallik

    Found one more thing for this CMP-CMR relationship and ejbActivate() and ejbPassivate() process of CMP Entity's.
    In this above example if say
    Entity A (Dept) ------ Entity B (Employee) (1:M) has one to many relationship
    Employee holds a FK value which is PK in Dept (dept_id).
    Suppose asssume that there are 10,000 employees working for a dept_id = 5.
    (i.e there are 10,000 records in Employee that references Dept table with dept_id =5)
    Now I want to add one more employee to this dept_id = 5, then I create an Employee entity and in the ejbPostCreate() method of Employee entity I lookup Dept Entity with Dept_PK=5, until this every thing is fine. Now I call setter method with in Employee Entity to set the dept such as setDept_dept_id(detpEntity5), at the execution of this method EJB container calls starts calling Employee Entity's the ejbActivate() method for 10,000 times this equals the number of references Employee table has to Dept table with Dept_ID=5, then at the end of the transaction the container calls ejbPassivate() method 10,000 times to passivate all those ejbs that it activated.
    Did some one experience the same thing with CMP EJBs? please let me know what I have to do to avoid such things?
    Thank you
    Mallik

  • 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.

  • Init method is called multiple times

    Hi,
    init method in my servlet is called more than 1 time.
    I think it is supposed to be called only 1 time,when the application is loaded.
    anything to do with web.xml ???
    or else what r the situations that init method is called more than 1 time
    thanks

    Hi,
    actually I figured out the problem.
    I am using logger staements for debugging.
    I am also using singlethread model for servlet.
    I came to know that it creates multiple instances of servlet...
    which inturn calls init method multiple times.
    i took out that singlethread model,now it is working perfect.
    Thanks

Maybe you are looking for

  • Hierarchy node not displaying some of child nodes

    Hi all, In my bex query for one of the hierarchy node  is not showing sum of its child nodes even though the belownodes got some data in it. What could be the reason.as all the other nodes at the same level are showing the sum of their child nodes. T

  • What is the procedure to transfor the data to idoc.

    Hi Abapers, What is the procedure to transfor the data to idoc. I have added some new fields in my program. so now i need to transfer those same filed into IDOC. Can any body tell me the procedure. Points will be given.

  • Can LV7.1 german create an application with english language

    Hallo, I'm working with labview 7.1 german version and like to create an application with english language. The main problems are the menus of the control elements (right click mouse) for instance x/y diagrams or knobs. Can anyone help me? Thanks, Mi

  • Date in sshr personalization

    I need to personalize employement verification to add some text along with todays date.I used javascript, but no luck. Can any one have idea how to get today's date. Thanks!!

  • How to stop Application deployment in sccm 2012?

    Hi All If a application is wrongly deployed to wrong collection in sccm 2012 how to stop that and where to change settings like we used to do in sccm 2007 we can stop it by program properties.