Create threadlocal     when called   multiple times ?

code to set in threadlocal
               @Override
     public void doWorkflowAction(WFEntity wfEntity, int actionId,
               Map<? extends  Object, ? extends  Object> inputs) {
          wfEntityService.createOrUpdate(wfEntity);
          String workflowName=wfEntity.getHibernateWorkflowEntry().getWorkflowName();
          OsWorkflowContext  workflowContext=OsWorkflowContextHolder.getWorkflowContext();
          workflowContext.setCaller(UserContextHolder.getUserName());
          workflowContext.setInstanceId(wfEntity.getProcessInstanceId());
          findWorkflowTemplate(workflowName, wfEntity.getOrgAbbrev()).doAction(actionId, inputs);
     }the method doWorkflowAction first creates threadlocal object calls doAction on the worklfowTemplate this will result in calling several other objects and if one the object calls doWorkflowAction with diffeerent paramenters
OsWorkflowContext workflowContext=OsWorkflowContextHolder.getWorkflowContext(); line will it create a new threadlocal varaible or update the current one?
its all running in the same thread , please advice
in other a method creates athreadlocal varaible and calls somemethod in that method I can access the threadlocalvariable if this method again creates the threadlocal variable will there be two threadlocalvaraibles in the same thread ?
I am confusd please help me understand.

more code sure
here I Have the method
     @Override
     public void doWorkflowAction(WFEntity wfEntity, int actionId,
               Map<? extends  Object, ? extends  Object> inputs) {
          wfEntityService.createOrUpdate(wfEntity);
          String workflowName=wfEntity.getHibernateWorkflowEntry().getWorkflowName();
          OsWorkflowContext  workflowContext=OsWorkflowContextHolder.getWorkflowContext();
          workflowContext.setCaller(UserContextHolder.getUserName());
          workflowContext.setInstanceId(wfEntity.getProcessInstanceId());
          findWorkflowTemplate(workflowName, wfEntity.getOrgAbbrev()).doAction(actionId, inputs);
     }this method is creating Threadlocal object using OsWorkflowContextHolder
public abstract class OsWorkflowContextHolder {
      * Holds the <code>OsWorkflowContext</code> on a per-thread basis.
     private static ThreadLocal workflowContextHolder = new ThreadLocal() {
          protected Object initialValue() {
               return new OsWorkflowContext();
      * Gets the <code>OsWorkflowContext</code> for the current thread.
     public static OsWorkflowContext getWorkflowContext() {
          return (OsWorkflowContext) workflowContextHolder.get();
      * Binds a new <code>OsWorkflowContext</code> to the current thread.
     public static void clearWorkflowContext() {
          workflowContextHolder.set(new OsWorkflowContext());
public class OsWorkflowContext {
      * Stores the workflow instance ID.
     private Long instanceId;
      * Stores the caller identity.
     private String caller;
      * Gets the workflow instance ID.
     public long getInstanceId() {
          return instanceId.longValue();
      * Sets the workflow instance ID.
     public void setInstanceId(long instanceId) {
          this.instanceId = new Long(instanceId);
      * Gets the caller identity.
     public String getCaller() {
          return caller;
      * Sets the caller identity.
     public void setCaller(String caller) {
          this.caller = caller;
      * Returns <code>true</code> if a workflow instance ID is currently bound to this context, else returns <code>false</code>.
     public boolean hasInstanceId() {
          return (instanceId != null);
}and finally calls
doAction(actionId, inputs);doAction(actionId, inputs); method has a big chain it calls several other objects and everywhere I need threadlocal object I call
          Workflow workflow = createWorkflow(OsWorkflowContextHolder.getWorkflowContext().getCaller());
now In one of the methods triggered by call to doAction(actionId, inputs); I cam calling
doWorkflowAction(WFEntity wfEntity, int actionId,
               Map<? extends  Object, ? extends  Object> inputs)
  this is second call , will this result in replacing the object in threadlocal or create a new object in threadlocal?
what happens after the second call ?
Edited by: user11138293 on Jan 16, 2013 3:29 PM
Edited by: user11138293 on Jan 16, 2013 3:30 PM
Edited by: user11138293 on Jan 16, 2013 3:30 PM

Similar Messages

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

  • Oracle Object Type Constructor Called Multiple Times

    I have an object type with a custom constructor. In SQL, when I reference the attributes the constructor is called multiple times in Oracle 11.2.0.4.
    Why is the constructor called multiple times?
    How do I stop it?
    My current work around is to reference the attributes and use the /*+ materialize */ hint.
    Problem Setup
        create or replace type Foo as object
          Bar1 NUMBER,
          Bar2 NUMBER,
          Bar3 NUMBER,
          CONSTRUCTOR FUNCTION Foo(p_Bar1 NUMBER, p_Bar2 NUMBER, p_Bar3 NUMBER)
            RETURN SELF AS RESULT
            DETERMINISTIC
        create or replace type body Foo is
          -- Member procedures and functions
          CONSTRUCTOR FUNCTION Foo(p_Bar1 NUMBER, p_Bar2 NUMBER, p_Bar3 NUMBER)
            RETURN SELF AS RESULT
            DETERMINISTIC
          AS
          BEGIN
            SELF.Bar1 := p_Bar1;
            SELF.Bar2 := p_Bar2;
            SELF.Bar3 := p_Bar3;
            dbms_output.put_line('Foo Constructor Called');
            RETURN;
          END;
        end;
    Problem
        -- Constructor is called 6 times!
        -- Once for each column and once for each predicate in the where clause.
        SELECT x.f.bar1 AS bar1, x.f.bar2 AS bar2, x.f.bar3 AS bar3, f
        FROM (
          SELECT foo(p_Bar1 => 1, p_Bar2 => 2, p_Bar3 => 3) f
          FROM dual d
        ) x
        WHERE x.f.bar1 = x.f.bar1 AND x.f.bar2 = x.f.bar2
    Output
    Foo Constructor Called
    Foo Constructor Called
    Foo Constructor Called
    Foo Constructor Called
    Foo Constructor Called
    Foo Constructor Called
    Workaround
        -- Work Around
        -- Constructor is called 3 times
        -- Once for each column in the inline view.
        -- Note, I removed column f (the object type) because it's not compatible with the materialize hint.
        WITH y AS (
          SELECT /*+ materialize */ x.f.bar1 AS bar1, x.f.bar2 AS bar2, x.f.bar3 AS bar3
          FROM (
            SELECT foo(p_Bar1 => 1, p_Bar2 => 2, p_Bar3 => 3) f
            FROM dual d
          ) x
        SELECT y.bar1, y.bar2, y.bar3
        FROM y
        WHERE y.bar1 = y.bar1 AND y.bar2 = y.bar2

    Another work-around is described in this thread... Accessing fields of a custom object type... which makes use of a collection type combined with the TABLE operator, like so...
    create or replace type FooTable as table of Foo;
    SELECT x.bar1 AS bar1, x.bar2 AS bar2, x.bar3 AS bar3, value(x) f
        FROM table(FooTable(
          foo(p_Bar1 => 1, p_Bar2 => 2, p_Bar3 => 3)
        )) x
        WHERE x.bar1 = x.bar1 AND x.bar2 = x.bar2
    BAR1 BAR2 BAR2 F
    1    2    3    (1, 2, 3)
    Foo Constructor Called
    Hope that helps...
    Gerard

  • On Execute operation, the bean getter is being called multiple times

    Hi,
    I have a JCR data control, i am trying to write a method that returns predicate, but this method is being called multiple times, when executing the advanced search operation.
      public List<Predicate> getPredicates() {
      ArrayList<Predicate> predicates = new ArrayList<Predicate>();
       // predicates.add(new Predicate("jcr:content/idc:metadata/idc:xScope",Operator.EQUALS,"GLOBAL"));
      DCBindingContainer bc=(DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
      JUCtrlListBinding attrBinding=(JUCtrlListBinding)  bc.findCtrlBinding("StateId");
      Object stateId= attrBinding.getSelectedValue();
      if(stateId instanceof Row){
      predicates.add(new Predicate("jcr:content/idc:metadata/idc:xState"
      , Operator.EQUALS
      ,((Row)stateId).getAttribute("StateId").toString()));
      attrBinding=(JUCtrlListBinding)  bc.findCtrlBinding("DistrictId");
      Object districtId=attrBinding.getSelectedValue();
      if(districtId instanceof Row){
          predicates.add(new Predicate("jcr:content/idc:metadata/idc:xDistrict",Operator.EQUALS,((Row)districtId).getAttribute("DistrictId").toString()));
        attrBinding=(JUCtrlListBinding)  bc.findCtrlBinding("Scope");
        Object scopeId=attrBinding.getSelectedValue();
        if(scopeId instanceof Row){
            predicates.add(new Predicate("jcr:content/idc:metadata/idc:xScope",Operator.EQUALS,((Row)scopeId).getAttribute("ScopeType")));
        AttributeBinding tempAttrBinding=(AttributeBinding)bc.findCtrlBinding("CreatedDate");
        Object createdDate=tempAttrBinding.getInputValue();
        if(createdDate!=null){
            predicates.add(new Predicate("jcr:content/jcr:created",Operator.EQUALS,createdDate.toString()));
        if (predicates.size()>0){
          return predicates;
      return Collections.emptyList();
      } The problem is while it's being called multiple times different list's are being returned which is causing the method not to work . The bean is in pageFlowScope .

    That is bc ADF life cicle... Is always executing 2 times...

  • Jnlp file called multiple times

    We're trying to pass HTTP parameters to our JNLP file (which is created by a .jsp file). When we run webstart from the command line (or a a web page), it seems like the JNLP file gets called multiple times. The first time our parameters are there, after that they are not. Why does webstart call the JNLP file multiple times? Has anyone else seen this.
    We're running Tomcat 4.x on Linux.
    From the command line we typed:
    javaws "http://localhost/helloWorld.jsp?hello=1&world=2"
    Tomcat Output:
    DEBUG: hello=1&world=2
    DEBUG: null
    DEBUG: null
    DEBUG: null
    DEBUG: null
    DEBUG: null
    DEBUG: null
    DEBUG: null
    JSP File:
    <!DOCTYPE html PUBLIC
    "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <%@ page contentType="application/x-java-jnlp-file" %>
    <?xml version="1.0" encoding="utf-8"?>
    <jnlp
    spec="1.0+"
    codebase="http://localhost"
    href="http://localhost/helloWorld.jsp">
    <information>
    <title>Hello World</title>
    <vendor>Nobody</vendor>
    <application-desc>Hello World Application</application-desc>
    </information>
    <resources>
    <j2se version="1.3+"/>
    <jar href="lib/helloWorld.jar" main="true"/>
    </resources>
    <application-desc main-class="test.HelloWorldApp"/>
    </jnlp>
    <% System.out.println("DEBUG: " + request.getQueryString()); %>
    Hello World Source:
    package test;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class HelloWorldApp {
    public static void main(String[] args) {
    JFrame frame = new JFrame("Hello World");
    frame.getContentPane().add(new JLabel("Hello World", JLabel.CENTER), BorderLayout.CENTER);
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    frame.setSize(200,150);
    frame.setVisible(true);
    }

    I am seeing this exact same problem, also creating the JNLP via a JSP. Any input would be greatly appreciated.

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

  • 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

  • JDK 6:  requestPasswordAuthentication called multiple times

    Hi...
    Has anyone else noticed that 'requestPasswordAuthentication' gets called multiple times from HTTPURLConnection in JDK 6? If I create an HTTPURLConnection, and it returns successfully from 'openConnection', if I then do something simple like query for its contentType via 'getContentType', a call to my authenticator requesting password authentication is made MULTIPLE times...
    In JDK 1.5, it was only made once in the same scenario.
    Have there been changes in the recent release that would require me to make changes to my authenticator or to supply more information?
    Thanks!
    Kelly

    We had a problem with NTLM authentication in 1.5 and Java SE 6, which may be the problem that you are seeing. There were actually two bugs in the same area that were fixed, 6520665 and 6357133.
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6520665
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6357133
    Both these bugs were fixed in the following releases:
    jdk 7 b12
    jdk 6 u3 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=2148156
    jdk 5u13 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=2149272
    I know that none of these releases are available yet except for jdk7. There is an early access version available from http://download.java.net/jdk7/binaries/ . Maybe you could install it an see if it resolves your problem.

  • Custom tag library called multiple times

    Hi ppl ,
    I have a custom tag library which i use to populate some menu components. When i do call my custom tag library though , it is called multiple times, use case is as follows.
    I have menu tabs and menu bars which thanks to Mr.Brenden is working splendidly as so:-
    <af:menuTabs>
    <af:forEach var="menuTab" items="#{bindings.menu.vwUserMenuTabRenderer.rangeSet}">
    <af:commandMenuItem text="#{menuTab.MenuLabel}"
    shortDesc="#{menuTab.MenuHint}"
    rendered="true"
    immediate="true"
    selected="#{sessionScope.selectedMenuId == menuTab.MenuId }"
    onclick="fnSetSelectedValue('#{menuTab.MenuId}')" >
    </af:commandMenuItem>
    </af:forEach>
    </af:menuTabs>
    <af:menuBar>
    <af:forEach var="menuBar" items="#{bindings.menu.vwUserMenuBarRenderer.rangeSet}">
    <af:commandMenuItem onclick="return clickreturnvalue()"
    onmouseover="dropdownmenu(this, event,#{menuBar.MenuId}, '150px')"
    onmouseout="delayhidemenu()"
    text="#{menuBar.MenuLabel}"
    action="#{menuBar.MenuUri}"
    rendered="#{menuBar.ParentId == sessionScope.selectedMenuId}"
    immediate="true" />
    </af:forEach>
    </af:menuBar>
    </afc:cache>
    now all of this code is within a subview , and just directly below the subview tag , i have the call to my custom tag library:-
    <myCustomTagLib:menuCascade />
    only issue now is that assuming i have in all 7 menu bar components, the doStartTag is called 7 times. the relevant code within my custom tag class is as follows :-
    public int doStartTag() throws JspException {
    return (EVAL_BODY_INCLUDE);
    public int doEndTag() throws JspException {
    try {
    declareVariables();
    return EVAL_PAGE;
    }catch (Exception ioe) {
    throw new JspException(ioe.getMessage());
    and within my declareVariables method i do an out of the jscript ( out.print(jscript.toString()); ) which is a simple string generated based on certain conditions...
    now it seems to be working fine on the front end , but when i view the source of the page, i notice that the declaration is called multiple times, and this happens because the doStartTag method is called multiple times, i haven't even nested the call to the custom tag within the menu components , any clue as to whats going wrong ?
    Cheers
    K

    Hi,
    if you add the following print statement
    System.out.println("rendering "+FacesContext.getCurrentInstance().getViewRoot().getViewId());
    Then the output in my case is
    07/04/24 08:14:04 rendering /BrowsePage.jsp
    07/04/24 08:14:05 rendering /otn_logo_small.gif
    The image comes from the file system, which means it is rendered by the JSF lifecycle. If you reference the image with a URL then the lifecycle doesn't render the image but only refrences it.
    To avoid your prepare render code to be executed multiple times, just check for jsp and jspx file extensions, which will guarantee that your code only executes for JSF pages, not for loaded files.
    The reason why this happens is because the JSF filter is set to /faces , which means all files that are loaded through that path
    Frank

  • CommandLink Disabled called multiple times

    Hello,
    I'm developing a brief method to enable/disable af:commandLink on certain condition.
    The layout is simple: a table to the left and a panelTabbed to the right. PanelTabbed has a partialTrigger to the table.
    In a visible tab there is a commandLink with Disabled attribute bound to a backingBean method.
    In this method I placed a System.out.println and I can see that this method is called multiple times.
    On pagestart the method is called 2 times.
    On table current row change the method is called 3 times.
    On tab change out of first tab 1 time.
    On tab change to first tab 2 times.
    I wen through all the way from commandLink to top component and there are no additional partialTriggers.
    Could someone explain this to me, please?
    Thanks.
    ADF 11.1.1.4

    Ilya,
    Have you tried using the ADF logger (see [url http://blogs.oracle.com/groundside/entry/adventures_in_logging_index]this blog for lots of details, especially part 5)? Replace your System.out.println calls with calls to the logger, crank up the logging level and use the log analyser to see by ADF/JSF phase when things are called.
    John

  • ItemEditEnd called multiple times

    Hi.
    Am using a datagrid and using an item editor and item render for that. Item Renderer --> To give background color and Item Editor - to show a date picker. While implementing this, my need is to open a popup when we enter date. But, am getting the popup thrice , sometimes during "on change"  and sometimes, when I press "Enter" or "Tab out" . When analyzed further, I noticed that itemEditEnd event is called thrice. Can anyone let me know the alternative for this please ? Here is my code.          
    <mx:AdvancedDataGrid width="1000" height="300" horizontalScrollPolicy="auto"
            id="dProvider" creationComplete="init()" verticalScrollPolicy="auto" editable="true" itemEditBeginning="checkIfAllowed(event)" selectionMode="singleCell" itemEditEnd="onEditEnd(event)">
                                    private function onEditEnd(event:AdvancedDataGridEvent):void
                                         var oTaskPopupObj:TaskPopUp = new TaskPopUp();
                            PopUpManager.addPopUp(oTaskPopupObj,this,true);
                                                        //This part is called thrice !!!
    I have been struggling to get rid of this issue. Would be very happy if I get a help quickly !
    Thanks
    Bala

    Thanks for being patient and answering my questions.
    And yes, the itemEditEnd is called multiple times, even for other scenarios. Find below a sample code, where-in,  iam using date editor to validate the field entered. Here too, the itemEditEnd is called thrice( you can notice that the alert creeps up thrice). Let me know if you need anything else
    Main mxml
    [[ [Bindable] 
    private var compManDataDef:XML =<CompManData>
    <row>
    <Phase>Program Start</Phase>
    <Date>Plan</Date>
    <Gate>Enter Date</Gate>
    <WBP>TBD</WBP>
    </row>
    <row>
    <Phase></Phase>
    <Date>Actual</Date>
    <Gate>TBD</Gate>
    <WBP>TBD</WBP>
    </row>
    private function onEditEnd(event:AdvancedDataGridEvent):void
    Alert.show("in date validate");
     <mx:AdvancedDataGrid width="100%" height="72%" horizontalScrollPolicy="auto" id="
    dProvider" creationComplete="init()" dragEnabled="true" lockedColumnCount="5" editable="true" itemEditBeginning="checkIfAllowed(event)" selectionMode="singleCell" itemEditEnd="onEditEnd(event)">
     <mx:columns>
     <mx:AdvancedDataGridColumn dataField="
    Phase"headerText="" width="
    137" wordWrap="true" textAlign="center" itemRenderer="renderer.ColorwithLable" editable="false">
     </mx:AdvancedDataGridColumn>
     <mx:AdvancedDataGridColumn dataField="
    Date"headerText="" width="
    120" itemRenderer="renderer.ColorwithLable" editable="false"/>  
    <mx:AdvancedDataGridColumn id="
    Gate" dataField="Gate"headerText="
    Gate" width="120" editorDataField="newEmployeeType" labelFunction="dglfFormatDate" itemEditor="dateEditing" itemRenderer="renderer.ColorwithLable" />
     <mx:AdvancedDataGridColumn id="
    WBP" dataField="WBP"headerText="
    WBP" width="120" itemRenderer="renderer.ColorwithLable"/>
    </mx:AdvancedDataGrid>
    editingDate.mxml......
    <?xml version="1.0" encoding="utf-8"?><mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initMe()" >
    <mx:Script><![CDATA[
     import mx.managers.PopUpManager; 
    import mx.controls.dataGridClasses.DataGridColumn; 
    import mx.controls.advancedDataGridClasses.AdvancedDataGridColumn; 
    import mx.controls.AdvancedDataGrid; 
    import mx.controls.advancedDataGridClasses.AdvancedDataGridListData; 
    Bindable] 
    public var tempVal:String = ""; 
    public var newEmployeeType:String = ""; 
    public var newEmployeeType1:String = ""; 
     private function dateChanged(date:Date):void {
     if (date == null)newEmployeeType =
    elsenewEmployeeType = (date.getMonth()+1).toString() +
    '/' + date.getDate().toString() + '/' + date.getFullYear().toString() ;}
    private function initMe():void{tempVal = data.Gate;
    if (tempVal != null) {dateField1.text =tempVal.toString();
    ]]>
    </mx:Script><mx:DateField id="dateField1" yearNavigationEnabled="true" change="dateChanged(DateField(event.target).selectedDate)"/></mx:HBox 
    >

  • Calling multiple times BAPI_GOODSMVT_CREATE getting error

    Hi Friends,
    I am calling multiple times BAPI_GOODSMVT_CREATE for same Purchase order to post goods receipt.
    for the first 4 times it is creating the GR successfully, but then it returning the message 'No goods receipt possible for purchase order 4500001004 01350'.
    Please help.
    Thanks
    Ravi

    Use Wait up to statement in loop.
    Ex:
    loop at it_filedir1.
        REFRESH I_TAB.
        CLEAR I_TAB.
       REFRESH I_TAB2.
       REFRESH ITAB1.
        data: g_file(100) type c .
        name = it_filedir1-name.
        concatenate: gfile '\' name into g_file.
        data : i_tab1(500).
        OPEN DATASET g_file FOR INPUT IN TEXT MODE
                                         ENCODING DEFAULT
                                         IGNORING CONVERSION ERRORS.
        IF SY-SUBRC EQ 0.
          DO.
            READ DATASET g_file INTO i_tab1.
            if sy-subrc = 0.
              split i_tab1 at ',' into  I_TAB-SOL_DOCNO I_TAB-SOL_DOCDT
               I_TAB-GI_TXN_TYPE I_TAB-WERKS I_TAB-LGOBE I_TAB-MATNR
               I_TAB-ERFMG I_TAB-ERFME.
            else.
              exit.
            endif.
            APPEND I_TAB.
            clear I_TAB.
          ENDDO.
        ENDIF.
        CLOSE DATASET g_file.
        concatenate: hfile '\' name into h_file.
        REFRESH I_MAIN.
        CLEAR I_MAIN.
        I_MAIN[] = I_TAB[].
        REFRESH I_OUT.
        CLEAR I_TAB.
        I_OUT[] = I_TAB[].
        DELETE ADJACENT DUPLICATES FROM I_TAB COMPARING SOL_DOCNO.
        SORT I_TAB BY SOL_DOCNO.
        LOOP AT I_TAB.
          count = sy-tabix.
          SELECT SINGLE * FROM ZMM_GI_WIP
                                    WHERE GI_NO = I_TAB-SOL_DOCNO AND
                                    GI_DATE = I_TAB-SOL_DOCDT.
          IF SY-SUBRC = 0.
            I_TAB-FLAG = 'C'.
            modify i_tab index count.
            CONCATENATE 'ERROR  GI : ' I_TAB-SOL_DOCNO
            '  WAS ALREADY UPLOADED' INTO I_MSG1.
            APPEND I_MSG1.
            CLEAR I_TAB-FLAG.
            CONTINUE.
          ELSE.
            CONCATENATE I_TAB-SOL_DOCDT+4(2)
                        I_TAB-SOL_DOCDT+6(2)
                        I_TAB-SOL_DOCDT+2(2)
                        I_TAB-SOL_DOCDT+0(2)
                        INTO G_DATE.
            gmhead-pstng_date = G_DATE.
            gmhead-doc_date = sy-datum.
            gmhead-pr_uname = sy-uname.
    "01 - MB01 - Goods Receipts for Purchase Order
            gmcode-gm_code = '03'.
            refresh itab.
            clear itab.
            SORT I_MAIN BY SOL_DOCNO.
            LOOP AT I_MAIN WHERE SOL_DOCNO = I_TAB-SOL_DOCNO.
              IF I_MAIN-GI_TXN_TYPE = 'RMGI'.
                itab-move_type  = '291'.
              ENDIF.
              itab-mvt_ind    = ' '.
              itab-plant      = I_MAIN-WERKS.
              itab-material   = I_MAIN-MATNR.
              itab-entry_qnt  = I_MAIN-ERFMG.
             itab-stge_loc   = 'OMR1'.
    itab-move_stloc = pcitab-recv_loc.
              itab-stge_loc   = I_MAIN-LGOBE.
              itab-ENTRY_UOM = I_MAIN-ERFME.
              IF I_MAIN-WERKS = 'OMR'.
                itab-TR_PART_BA = '11'.
              ELSEIF I_MAIN-WERKS = 'OMR'.
                itab-TR_PART_BA = '12'.
              ENDIF.
              append itab.
            ENDLOOP.
            if not itab[] is initial.
              call function 'BAPI_GOODSMVT_CREATE'
               exporting
                   goodsmvt_header             = gmhead
                   goodsmvt_code               = gmcode
                 *   TESTRUN                     = ' '
              IMPORTING
                  goodsmvt_headret            = mthead
             *   MATERIALDOCUMENT            =
      MATDOCUMENTYEAR             =
               tables
                 goodsmvt_item               = itab
      GOODSMVT_SERIALNUMBER       =
                return                      = errmsg.
              clear errflag.
              loop at errmsg.
                if errmsg-type eq 'E'.
                  write:/'Error in function', errmsg-message.
                  errflag = 'X'.
                else.
                  write:/ errmsg-message.
                endif.
                move errmsg-message to i_msg1.
                append i_msg1.
              endloop.
              if errflag is initial.
                CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
              EXPORTING
                WAIT          =
              IMPORTING
                RETURN        =
               commit work and wait.
                if sy-subrc ne 0.
                  write:/ 'Error in updating'.
                  exit.
                else.
                  write:/ mthead-mat_doc, mthead-doc_year.
                  ZMM_GI_WIP-GI_NO = I_TAB-SOL_DOCNO.
                  ZMM_GI_WIP-GI_DATE = I_TAB-SOL_DOCDT.
                  INSERT ZMM_GI_WIP.
                  COMMIT WORK.
                  I_TAB-FLAG = 'C'.
                  MODIFY I_TAB INDEX COUNT.
                  CONCATENATE mthead-mat_doc  mthead-doc_year
                             into i_msg1.
                  append i_msg1.
                 perform upd_sta.
                endif.
              endif.
            endif.
          ENDIF.
           wait up to 20 seconds.
        ENDLOOP.

  • Listener method is called multiple times

    why is a listener method called multiple times when the user interacted
    with the component just once?

    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.

  • Firefox making same GET call multiple times

    Firefox is making the same AJAX call multiple times for a single event when it should really do it once. Actually, with each single click the number of calls multiplies. I have tested the application using Chromium and Eclipse's internal browser and I have no problems.
    I removed all add-ons and started Firefox in safe-mode, but the problem persists.
    Please advise,
    Arthur Nobrega

    Hi Arthur, do you have a page available that demonstrates this problem? If so, please post a link. Perhaps your test doesn't actually need to make a network request: for example, perhaps it could add a message to the page indicating that the relevant section of code was triggered.
    Since this site focuses on end user support, you might also consider taking this question to a more developer-oriented forum such as the unofficial [http://forums.mozillazine.org/viewforum.php?f=25 mozillaZine Web Development board], or to StackExchange.

  • Generic Data Source is calling multiple times in RSA3

    [color:red}<Moderator Message: This topic has alread been discussed a lot of times. Additionally there are weblogs related to it. Please search the forums and/or the blogs for this issue>
    Hi experts,
    I have the requirement to get data from Generic Data Sources with function Module,
    after finishing the FM I have checked in extact checker(RSA)
    in the internal table I_T_DATA is displays 281 records,
    but in RSA3 it shows 112560 records, I found that the FM is calling multiple time by executing one time in RSA3.
    1.what would be the problem
    2.where is the porblem is it in FM coding or any other places to check.
    <removed by moderator>
    Regards
    Vijay
    Edited by: Siegfried Szameitat on Feb 3, 2009 11:45 AM

    Hi Savita,
    I don't understand clearly from your reply regarding flow you transported and what all you transported.
    You need to first transport objects in R/3 and import them.
    Then transport Infoprovider, Datasource in BI assuming depenedent Infoare Infoobject, application component already transported.
    Then transport your Infosource, Update rule, Transfer rules, Infopackage.
    Hope you understood.
    Ravi

Maybe you are looking for

  • Incremental Garbage Collector is halting my server for MINUTES at a time.

    I have a Java server which services hundreds (currently 300-700 on average, target of 2000+) of simultaneous client connections, with a staggering number of long lived (but not permanent) objects. The docs for incremental garbage collection state: "T

  • Report with drill-down needs to start display at lowest level

    Hi, I'm not sure if this is in the correct forum but I'm hoping that a moderator will move it to the correct area if there is a better place for this. I have a report working that shows Master Project information, drills to Projects information and t

  • No sleep with multiple users logged in

    Hi there, In order to access multiple iTunes-Libraries from my apple TV (Main, Archive, Childrens) I have set up three useraccounts on my macMini each with its own iTunes Library. When booting up I log in to all three accounts and start iTunes. It al

  • How can i play a whole album rather than one song at a time

    I have just purchased a ipod Nano 6th generation to use whilst cycling. I've tried it out indoors and it only seems to play one song at a time I would like to listen to an album or play list without stopping. how do I do this??????

  • PLEASE APPLE - Give us Expandable Memory in iPhone

    I would LOVE to be able to have only 1 device to serve the purposes of phone, music and camera. But, I'm a music junkie and have SO much more than 32GB of music to put on an iPhone. PLEASE PLEASE PLEASE give us the ability to add memory to the next i