2 Replies Latest reply on Jan 26, 2004 7:25 PM by Matthew Purdy

    is there a what to create a read/write application variable

    Matthew Purdy Newbie

      using <env-entry> you can change a variable at deployment time, however after that, it is a static value. i you need to share a variable over an application, it doesnt help.

      is there a way to create a variable for an application (like an env-entry) which allows you to update the value.

      here is example code that explains what i need:
      ----------------------------------------------------------------
      long getNextKey() throws NamingException
      {
      long ret = -1;

      InitialContext jndiContext = new InitialContext();
      ret = ((Long)jndiContext.lookup("java:comp/env/lastContainerKey")).longValue();
      ret++;
      jndiContext.addToEnvironment("java:comp/env/lastContainerKey", new Long(ret));

      return ret;

      }//end getNextKey

      ---------------------------------------------------------------