Values in Public Static Object between Server Program & Servlet Program

Hi all.
I don't understand how to solve this problem.
I am trying to refer a shared variable(file) at webbrowser & sever demon program at the same time.
my code is..
<pre>
// write program ( called by server p/g & servlet p/g )
public class WriteWhat
public synchronized static String write(String what) throws Exception
String FileName = "/home/myAccount/testFile";
char intxt[] = new char[LogData.length()];
what.getChars(0,what.length(),intxt,0);
try // if File Exist
FileWriter fw = new FileWriter(FileName,true);
fw.write(intxt);
fw.close();
catch(Exception e) // if File NOT Exist
finally
return(FileName);
</pre>
The Testfile is updated fine at servlet program called
but does Not Work at SERVER PROGRAM CALL (with No Error Message)....T.T
sorry about my english...but you will know what I mean.
Regard, devport.

to be clear, you want 2 programs to append to the same file...
FileWriter 's constructor may fail (throw an exception) if the file is already open (depends on operating system)
you really should use the catch(IOException){
to give you or your program a better idea of whats going on...
what operating system are you using, or does this code need to work anywhere?

Similar Messages

  • Serialize the object between Server and Client?

    Hello friends,
    What is the important to Serialize the object between server and client?
    Thanks
    tamilvanan

    in which context ??
    Anyways,checkout the below link and try to understand how do we convert Serializable Object's State to in Stream and send it over network.
    http://java.sun.com/j2se/1.4.2/docs/guide/serialization/examples/index.html
    Hope that might help :)
    REGARDS,
    RaHuL

  • Using public static object for locking thread shared resources

    Lets Consider the example,
    I have two classes
    1.  Main_Reader -- Read from file
    public  class Main_Reader
         public static object tloc=new object();
           public void Readfile(object mydocpath1)
               lock (tloc)
                   string mydocpath = (string)mydocpath1;
                   StringBuilder sb = new StringBuilder();
                   using (StreamReader sr = new StreamReader(mydocpath))
                       String line;
                       // Read and display lines from the file until the end of 
                       // the file is reached.
                       while ((line = sr.ReadLine()) != null)
                           sb.AppendLine(line);
                   string allines = sb.ToString();
    2. MainWriter -- Write the file
    public  class MainWriter
          public void Writefile(object mydocpath1)
              lock (Main_Reader.tloc)
                  string mydocpath = (string)mydocpath1;
                  // Compose a string that consists of three lines.
                  string lines = "First line.\r\nSecond line.\r\nThird line.";
                  // Write the string to a file.
                  System.IO.StreamWriter file = new System.IO.StreamWriter(mydocpath);
                  file.WriteLine(lines);
                  file.Close();
                  Thread.Sleep(10000);
    In main have instatiated two function with two threads.
     public string mydocpath = "E:\\testlist.txt";  //Here mydocpath is shared resorces
             MainWriter mwr=new MainWriter();
             Writefile wrt=new Writefile();
               private void button1_Click(object sender, EventArgs e)
                Thread t2 = new Thread(new ParameterizedThreadStart(wrt.Writefile));
                t2.Start(mydocpath);
                Thread t1 = new Thread(new ParameterizedThreadStart(mrw.Readfile));
                t1.Start(mydocpath);
                MessageBox.Show("Read kick off----------");
    For making this shared resource thread safe, i am using  a public static field,
      public static object tloc=new object();   in class Main_Reader
    My Question is ,is it a good approach.
    Because i read in one of msdn forums, "avoid locking on a public type"
    Is any other approach for making this thread safe.

    Hi ,
    Since they are easily accessed by all threads, thus you need to apply any kind of synchronization (via locks, signals, mutex, etc).
    Mutex:https://msdn.microsoft.com/en-us/library/system.threading.mutex(v=vs.110).aspx
    Thread signaling basics:http://stackoverflow.com/questions/2696052/thread-signaling-basics
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Urgent: problem with sharing HttpSession  object between Jsp and servlets.

    Hi,
              We are using weblogic 6.0 sp2.
              I m setting a particular object in session in a servlet using
              session.setAttribute() but when i try to retrieve that object using
              session.getAttribute() in a jsp page the value of that object is null. Is
              there any way to configure HttpSession in weblogic so that jsps and servlet
              can share the same session? Or any workaround for this problem.
              Any help in this regard is appreciated.
              Thanks
              -Shree
              

    Just a guess, but it sounds like you have cookies turned off and are not
              using encodeURL. Try enabling cookies and see if that solves the problem.
              Also, it is generally good practice to use encodeURL to protect yourself
              from users who disable session cookies.
              Here's how we use encodeURL in our Servlets:
              gotoPage("/jsp/someJSP.jsp");
              private void gotoPage( String address,
              HttpServletRequest request,
              HttpServletResponse response )
              throws ServletException, IOException
              RequestDispatcher dispatcher =
              etServletContext().getRequestDispatcher( response.encodeURL( address ));
              dispatcher.forward( request, response );
              "Shree Unde" <[email protected]> wrote in message
              news:[email protected]..
              > Hi,
              > We are using weblogic 6.0 sp2.
              > I m setting a particular object in session in a servlet using
              > session.setAttribute() but when i try to retrieve that object using
              > session.getAttribute() in a jsp page the value of that object is null. Is
              > there any way to configure HttpSession in weblogic so that jsps and
              servlet
              > can share the same session? Or any workaround for this problem.
              > Any help in this regard is appreciated.
              > Thanks
              > -Shree
              >
              >
              

  • How can I share a static field between 2 class loaders?

    Hi,
    I've been googling for 2 days and it now seems I'm not understanding something because nobody seems to have my problem. Please, somebody tell me if I'm crazy.
    The system's architecture:
    I've got a web application running in a SunOne server. The app uses Struts for the MVC part and Spring to deal with business services and DAOs.
    Beside the web app, beyond the application context, but in the same physical server, there are some processes, kind of batch processes that update tables and that kind of stuff, that run once a day. Theese processes are plain Java classes, with a main method, that are executed from ".sh" scripts with the "java" command.
    What do I need to do?
    "Simple". I need one of those Java processes to use one of the web app's service. This service has some DAOs injected by Spring. And the service itself is a bean defined in the Spring configuration file.
    The solution is made-up of 2 parts:
    1. I created a class, in the web app, with a static method that returns any bean defined in the Spring configuration file, or in other words, any bean in the application context. In my case, this method returns the service I need.
    public class SpringApplicationContext implements ApplicationContextAware {
         private static ApplicationContext appContext;
         public void setApplicationContext(ApplicationContext context) throws BeansException {
              appContext = context;
         public static Object getBean(String nombreBean) {
              return appContext.getBean(nombreBean);
    }The ApplicationContext is injected to the class by Spring through the setApplicationContext method. This is set in the Spring configuration file.
    Well, this works fine if I call the getBean method from any class in the web app. But that's not what I need. I need to get a bean from outside the web app. From the "Java batch process".
    2. Why doesn't it work from outside the web app? Because when I call getBean from the process outside the web app, a different class loader is executed to load the SpringApplicationContext class. Thus, the static field appContext is null. Am I right?
    So, the question I need you to please answer me, the question I didn't find in Google:
    How can I share the static field between the 2 class loaders?
    If I can't, how can I load the SpringApplicationContext class, from the "Java batch process", with the same class loader my web app was started?
    Or, do I need to load the SpringApplicationContext class again? Can't I use, from the process, the class already loaded by my web app?
    I' sorry about my so extensive post...
    Thank you very much!

    zibilico wrote:
    But maybe, if the web service stuff gets to complicated or it doesn't fulfill my needs, I'll set up a separate Spring context, that gets loaded everytime I run the "Java batch process". It'll have it's own Spring configuration files (these will be a fragment of the web app's config files), where I'll define only the beans I need to use, say the service and the 2 DAOs, and also the DB connection. Additionally, I'll set the classpath to use the beans classes of the web app. Thus, if the service and DAOs were modified in the app server, the process would load the modified classes in the following execution.You'll almost certainly have to do that even if you do use RMI, Web services etc. to connect.
    What I suggest is that you split your web project into two source trees, the stuff that relates strictly to the web front end and the code which will be shared with the batch. The latter can then be treated as a library used by both the batch and web projects. That can include splitting Spring configuration files into common and specific, the common beans file can be retrieved from the classpath with an include. I regularly split web projects this way anyway, it helps impose decoupling between View/Controller and Model layers.
    On the other hand, you might consider running these batch processes inside the web server on background threads.

  • How can i pass the values to method public static void showBoard(boolean[][

    I need x and y to pass to the method
    public static void showBoard(boolean[][] board
    i am very confused as to why its boolean,i know its an array but does that mean values ar true or false only?Thanks
    import java.util.Random;
    import java.util.Scanner;
    public class Life1
         public static void main(String[] args)
              int x=0;
              int y=0;
              Scanner keyIn = new Scanner(System.in);
              System.out.println("Enter the first dimension of the board : ");
              x = keyIn.nextInt();
              System.out.println("Enter the second dimension of the board : );
              y = keyIn.nextInt();
              boolean[][] board = new boolean[x][y];
              fillBoard(board);
              showBoard(board);
              //Ask the user how many generations to show.
              board = newBoard(board);
              showBoard(board);
         //This method randomly populates rows 5-9 of the board
         //Rewrite this method to allow the user to populate the board by entering the
         //coordinates of the live cells.  If the user requests that cell 1, 1 be alive,
         //your program should make cell 0,0 alive.
         public static void fillBoard(boolean[][] board)
              int row, col, isAlive;
              Random picker = new Random();
              for(row = 4; row < 9; row++)
                   for(col = 4; col < 9; col++)
                        if (picker.nextInt(2) == 0)
                          board[row][col] = false;
                        else
                          board[row][col] = true;
         //This method displays the board
         public static void showBoard(boolean[][] board)
              int row, col;
              System.out.println();
              for(row=0; row < x; row++)
                   for(col=0; col<y; col++)
                        if (board[row][col])
                             System.out.print("X");
                        else
                             System.out.print(".");
                   System.out.println();
              System.out.println();
         //This method creates the next generation and returns the new population
         public static boolean[][] newBoard(boolean[][] board)
              int row;
              int col;
              int neighbors;
              boolean[][] newBoard = new boolean[board.length][board[0].length];
              makeDead(newBoard);
              for(row = 1; row < board.length-1; row++)
                   for(col = 1; col < board[row].length-1; col++)
                        neighbors = countNeighbors(row, col, board);
                        //make this work with one less if
                        if (neighbors < 2)
                             newBoard[row][col]=false;
                        else if (neighbors > 3)
                             newBoard[row][col] = false;
                        else if (neighbors == 2)
                             newBoard[row][col]= board[row][col];
                        else
                             newBoard[row][col] = true;
              return newBoard;
         //This method counts the number of neighbors surrounding a cell.
         //It is given the current cell coordinates and the board
         public static int countNeighbors(int thisRow, int thisCol, boolean[][] board)
              int count = 0;
              int row, col;
              for (row = thisRow - 1; row < thisRow + 2; row++)
                   for(col = thisCol - 1; col < thisCol + 2; col++)
                     if (board[row][col])
                          count++;
              if (board[thisRow][thisCol])
                   count--;
              return count;
         //This method makes each cell in a board "dead."
         public static void makeDead(boolean[][] board)
              int row, col;
              for(row = 0; row < board.length; row++)
                   for(col = 0; col < board[row].length; col++)
                        board[row][col] = false;
    }

    this is what im workin with mabey you can point me in the right directionimport java.util.Random;
    /* This class creates an application to simulate John Conway's Life game.
    * Output is sent to the System.out object.
    * The rules for the Life game are as follows...
    * Your final version of the program should explain the game and its use
    * to the user.
    public class Life
         public static void main(String[] args)
              //Allow the user to specify the board size
              boolean[][] board = new boolean[10][10];
              fillBoard(board);
              showBoard(board);
              //Ask the user how many generations to show.
              board = newBoard(board);
              showBoard(board);
         //This method randomly populates rows 5-9 of the board
         //Rewrite this method to allow the user to populate the board by entering the
         //coordinates of the live cells.  If the user requests that cell 1, 1 be alive,
         //your program should make cell 0,0 alive.
         public static void fillBoard(boolean[][] board)
              int row, col, isAlive;
              Random picker = new Random();
              for(row = 4; row < 9; row++)
                   for(col = 4; col < 9; col++)
                        if (picker.nextInt(2) == 0)
                          board[row][col] = false;
                        else
                          board[row][col] = true;
         //This method displays the board
         public static void showBoard(boolean[][] board)
              int row, col;
              System.out.println();
              for(row=0; row < 10; row++)
                   for(col=0; col<10; col++)
                        if (board[row][col])
                             System.out.print("X");
                        else
                             System.out.print(".");
                   System.out.println();
              System.out.println();
         //This method creates the next generation and returns the new population
         public static boolean[][] newBoard(boolean[][] board)
              int row;
              int col;
              int neighbors;
              boolean[][] newBoard = new boolean[board.length][board[0].length];
              makeDead(newBoard);
              for(row = 1; row < board.length-1; row++)
                   for(col = 1; col < board[row].length-1; col++)
                        neighbors = countNeighbors(row, col, board);
                        //make this work with one less if
                        if (neighbors < 2)
                             newBoard[row][col]=false;
                        else if (neighbors > 3)
                             newBoard[row][col] = false;
                        else if (neighbors == 2)
                             newBoard[row][col]= board[row][col];
                        else
                             newBoard[row][col] = true;
              return newBoard;
         //This method counts the number of neighbors surrounding a cell.
         //It is given the current cell coordinates and the board
         public static int countNeighbors(int thisRow, int thisCol, boolean[][] board)
              int count = 0;
              int row, col;
              for (row = thisRow - 1; row < thisRow + 2; row++)
                   for(col = thisCol - 1; col < thisCol + 2; col++)
                     if (board[row][col])
                          count++;
              if (board[thisRow][thisCol])
                   count--;
              return count;
         //This method makes each cell in a board "dead."
         public static void makeDead(boolean[][] board)
              int row, col;
              for(row = 0; row < board.length; row++)
                   for(col = 0; col < board[row].length; col++)
                        board[row][col] = false;
    }

  • Constant values (public static final String) are not shown??

    This has already been posted and no body answered. Any help is appreciated.
    In web service is it possible to expose the Constants used in the application. Let say for my web service I need to pass value for Operation, possible values for this are (add, delete, update). Is it possible expose these constant values(add, delete, update) visible to client application accesssing the web service.
    Server Side:
    public static final String ADD = "ADDOPP";
    public static final String DELETE = "DELETEOPP";
    public static final String UPDATE = "UPDATEOPP";
    client Side: mywebserviceport.setOperation( mywebservicePort.ADD );
    thanks
    vijay

    Sure, you can use JAX-WS and enums.
    For example on the server:
    @WebService
    public class echo {
    public enum Status {RED, YELLOW, GREEN}
    @WebMethod
    public Status echoStatus(Status status) {
    return status;
    on the client you get.
    @WebService(name = "Echo", wsdlLocation ="..." )
    public interface Echo {
    @WebMethod
    public Status echoStatus(
    @WebParam(name = "arg0", targetNamespace = "")
    Status arg0);
    @XmlEnum
    public enum Status {
    GREEN,
    RED,
    YELLOW;
    public String value() {
    return name();
    public static Status fromValue(String v) {
    return valueOf(v);
    }

  • View link between 2 public view object(PVO)

    Hi,
    Can we create a view link between 2 Public View Object(PVOs)? Is as same as creating view link b/w normal VOs.
    Regards,
    Suresh

    Hi,
    whats mean Public View Object? do you use BI?

  • Trying to acces the value of a public static final int using reflection

    -Java 6
    -Windows XP
    -Signed Applet
    doing the following:
    Class.forName(classname).getField(code).getInt(null);
    is giving me the error:
    java.lang.IllegalAccessException: Class com.cc.applet.util.ServiceConfiguration can not access a member of class com.cc.util.error.codes.SendMessageErrorCodes with modifiers "public static final"
         at sun.reflect.Reflection.ensureMemberAccess(Unknown Source)
         at java.lang.reflect.Field.doSecurityCheck(Unknown Source)
         at java.lang.reflect.Field.getFieldAccessor(Unknown Source)
         at java.lang.reflect.Field.getInt(Unknown Source)
    I'm not understanding why it can't access the value of the field. Any help would be great.
    Edited by: zparticle on Oct 17, 2007 11:07 PM

    stefan.schulz wrote:
    oebert, you are right. Good one.
    I actually think that, in this case, the message is misleading. The current implementation of sun.reflect.Reflection.ensureMemberAccess() treats any failing access check the same. It should and could inculde better contextual information.Stefan,
    That is a good point. Did you file a RFE with Sun yet? I also think they should provide a more contextual error message in this case.
    Gili

  • Why can't created an object in the "public static void main(String args[])"

    Example:
    public Class Exp {
    public static void main(String args[])
    new Exp2();-------------> To Occur Error
    Class Exp2 {
    public Exp2()

    You can't create an inner class within main, because
    it is a static method. Inner classes can only be
    created by true class methods.This is not correct. You can create an inner class object in a static method. You just have to specify an outer class object that the inner class object should be created within:
    Exp2 exp2 = new Exp().new Exp2();

  • Copying values of a singular authorization object between roles?

    Suppose I have an authorization object assigned to a role and its fields hold a large amount of data (say S_TCODE with a lot of transaction codes specified via ranges). Suppose further that I want to have this same object with this same data in another role. The other objects of the two roles are different and I'd rather not type the large amount of data into the authorization object again.
    Is there a way to copy/paste just one authorization object between two roles?
    I know how to make a copy of an authorization object and its values within the same role, but I haven't found a way to copy between roles.
    ursa

    Hi Ursa,
    I havent come across any export object kinda thing...
    This may help you in practical situation...
    Let us consider your particular requirement related to s_tcode.
    for that go to suim -
    transactions -> executable for role .
    Give the role name get the list of transaction codes.
    Download into excel file. then copy from there and paste into your new role menu or in s_tcode object.
    Mostly we dont get that much list for other objects.
    One more thing you can do.
    click on display tab beside the object in your source role, you get the list window.
    type ctrl + Y and then copy the 7-8 lines and paste it in the object of new role.
    Cheers.
    Shamish
    Message was edited by:
            Shamish Lele

  • Sending object between client server with some class without serializable

    Hi friend,
    I need to send the object from server to client via ObjectInputStream and ObjectOutputStream, however, in these objects, some are implements by others, no source code provided, which haven't implement serizlizable, so does anyone can tell me what I can do?
    Thanks your concern.
    Cheers,
    Alva

    Anyone can help? It is urgent!
    Thanks,
    Alva

  • Public static vs private

    Hi
    I have 3 classes, A, B & C.
    I have one variable, var, that can be used in class B and C; I have declared it in class B, and passed when I create an istance of C in B.
    Then I need also to read its value in class A.
    Now the ways are two (I think ...):
    1. declare it as public static in class A and then use A.var in class B and C;
    2. declare it as private in A and then passed to B when I create in A an istance of B and to C then I create in B an istance to C.
    Considerations:
    a. I don't like to declare public variables, I think is a bad way to program,
    isn'it?
    b. the second way is a problem when I have 10 variables (the constructors have too many parameters), right?
    Could anyone help?

    The problem is I tryied to find these answer in
    Intenrnet, but I don't find anything.That's fine. That's why most of us are here.
    My application works as this:
    I have a main class (A) that have a main menu in
    console style; from this class I create a new client
    class (B) that receive commands from a server; if a
    command is valid, B create an istance of C that
    rappresents a trainer machine. In C I have all
    workout variables (time, incline, speed ...).
    By menu (in class A) i could pause the trainer and by
    A and/or remote server I could ask the state of the
    machine (C).
    In your explanation above, I draw your attention to "instance". You are making instances of your classes. That being the case, your variables should probably be instance variables
    NOT
    public static int firstVariable = 0;BUT
    protected int firstVariable = 0;You would then provide get and set methods to access the protected variable.
    If you find yourself writing B b = new B() then you know you are dealing with an instance and you should avoid all static variables unless you really do mean "this value is the same across all Bs".
    I have 8 state variables I could manage in that way.
    The only way I have for now found is definite a
    public static long vars in C (and use them in A e B
    as C.state, C.time, ...) to avoid to pass 8
    parameters when I create the istances from A to C.Assuming that C has eight variables and your design isn't done yet you can still pass an instance of C to the other objects. They don't need to have their method/constructor signatures changed when you add a new variable as your C object encapsulates it already.
    >
    Is right? Any other suggestion?Yes. Don't stick to "C.time" because that's what you've got so far. Instead, you should be using
    C c = new C();
    c.getTime();That way, the time variable is unique to the instance.

  • Static Objects as global Object?

    I want to have an object in my application that is global, and changeable to all the other classes/objects inside the program.
    I was wondering if this is what a static class is? AFAIK, static classes mean that there are only ever one instance of them running and you can access and change the values from anywhere in the program. Is this true? Or am i confused by singletons.

    There's no such thing as a static class, per se. Every class is 'static' in that there is only one copy of the class definition itself in the JVM.
    A static variable is one that belongs to the class instead of an instance. So if you had a (public) static variable 'globalCount' in the class StaticClass, any other class could get that value with StaticClass.globalCount. Even if there is no instance of StaticClass at all, that variable belongs to the class and not the instance.
    Singleton is a technique that makes use of this property, by carefully controlling a static value. In it, a class has a private static instance of itself, and a static method that returns that to other classes. You'd also make the constructor private so that no other class could instantiate it, thus maintaining a single copy.
    So to answer your question, if you have an object instance that you want to share across different parts of the program, your best bet is to use the Singleton pattern, which in turn uses static variables/methods.

  • How to persistent static object

    JDO always assigns a StateManager to a PersistenceCapable object when
    creating instance. If an object is static, it'll keep its StateManager for
    ever after instantiation. So If I excute the following code repeadly, kodo
    will complain that persistence manager has been closed.
    1) Get PersistenceManager
    2) Begin transaction
    3) Get object from datastore. If not exist, create a new object. This
    object is a static.
    4) Commit transaction
    5) pm.close
    For the first time, kodo will assign a new StateManager to this static
    object. But for the second time, exception, "persistence manager has been
    closed", will arise when excuting some of object's methods. Because each
    StateManager object owns a PersistenceManager object. If this pm is
    closed, according StateManager object is also useless.
    After enhancing, kodo will change some getter/setter methods to
    according jdo getter/setter ones. These methods may invoke
    startManager.isLoaded(), which invokes pm.isActive(). Unfortunately, pm
    has been closed.
    Any other tricky methods to persistent static object ?
    Thanks !

    Dear Marc,
    Thanks for your kind help. It's an effective advice to prevent
    persistent object from being static.
    However, what if the object to be persistent is an enumeration type
    constant ? For example :
    public class MyEnumType
    private String name = null;
    private int value = 0;
    protected MyEnumType( String name, int value )
    this.name = name;
    this.value = value;
    public static final TYPE_1 = new MyEnumType( "type 1", 1 );
    public class EnumTypeUseClass
    private MyEnumType type = null;
    public void setType(..) {..}
    public MyEnumType getType() {..}
    public class TestClass
    public void f()
    PersistenceManager pm = null;
    try
    // Obtain pm
    pm = ...;
    pm.currentTransaction().begin();
    EnumTypeUseClass use = new EnumTypeUseClass();
    // Obtain myenumtype object from datastore
    MyEnumType type = getJdoObject( pm, MyEnumType.class, "value ==" +
    MyEnumType.TYPE_1.getValue() );
    // Following line will cause "PersistenceManager has been closed"
    exception
    use.setType( type );
    pm.makePersistent( use );
    pm.currentTransaction().commit();
    catch( .. )
    finally
    pm.close();
    public static void main( String args[] )
    for( int i = 0; i < 10; i ++ )
    f();
    Actually, exception is caused by MyEnumType.TYPE_1.getValue() because
    this object's pm has been closed in the first loop time.
    Now I solved this problem by not persistent MyEnumType objects, and
    change type field in EnumTypeUseClass from MyEnumType to int.
    But I still wonder how to persistent static objects.
    Maybe your first advice is feasible, but I think it will make your
    program tangly. Do you think so ? :)
    Marc Prud'hommeaux wrote:
    Liang-
    You are correct that a persistent instance must be associated with a
    PersistenceManager. You could always just leave the PersistenceManager
    open (if using optimistic transaction, Kodo won't tie up database
    resources in this case). Another option is to not have the singleston
    instance be a static variable, but have it be obtained via a factory
    method that takes a PersistenceManager argument.
    If this doesn't help, perhaps you could help clarify the situation by
    posting some code that shows that you would like to do?
    In article <[email protected]>, Liang Zhilong wrote:
    JDO always assigns a StateManager to a PersistenceCapable object when
    creating instance. If an object is static, it'll keep its StateManager for
    ever after instantiation. So If I excute the following code repeadly, kodo
    will complain that persistence manager has been closed.
    1) Get PersistenceManager
    2) Begin transaction
    3) Get object from datastore. If not exist, create a new object. This
    object is a static.
    4) Commit transaction
    5) pm.close
    For the first time, kodo will assign a new StateManager to this static
    object. But for the second time, exception, "persistence manager has been
    closed", will arise when excuting some of object's methods. Because each
    StateManager object owns a PersistenceManager object. If this pm is
    closed, according StateManager object is also useless.
    After enhancing, kodo will change some getter/setter methods to
    according jdo getter/setter ones. These methods may invoke
    startManager.isLoaded(), which invokes pm.isActive(). Unfortunately, pm
    has been closed.
    Any other tricky methods to persistent static object ?
    Thanks !
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com

Maybe you are looking for