Thanks your "synchronization" idea solved my problem of null reference ,

The reference is propery getting null, I just checked,

Regarding reinitialization, I just put my initialization code in execute
method of the action.

and made something like

public class ClsAction extends Action {

public static GraphicsServer myServer = null;

   Actionforward execute(){
        if(myServer == null)
                    myServer  = ClsInitializeServer.getInitializeInstance();
   }

}



Thanks and Regards,
Kapil Sharma


-----Original Message-----
From: Kapil Sharma [mailto:[EMAIL PROTECTED]
Sent: Friday, June 01, 2007 11:33 AM
To: Struts Users Mailing List
Subject: RE: The class variable reference null problem


I tried your method , debug the program , it shows that the variable becomes
null,

But after login in again the "public static GraphicsServer myServer =
ClsInitializeServer.getInitializeInstance(); "  class level variable does
not execute but still its refrence is available to other parts of the
program.

This is not the case of simple class, i think so, Struts use it as another
ways. It keep all the class level variables as application level and does
not initilaze them again.

But I am wondering how to make it initialize every time.

Thanks and Regards,
Kapil Sharma



-----Original Message-----
From: Fei Fei [mailto:[EMAIL PROTECTED]
Sent: Friday, June 01, 2007 11:06 AM
To: Struts Users Mailing List
Subject: RE: The class variable reference null problem



you can try to do something like this:
public class ClsAction extends Action {                 // Start Intialize the 
instance
of the graphics serverpublic Object lockObj = new Object();public static
GraphicsServer myServer = ClsInitializeServer.getInitializeInstance();  //
End     another methods(){              . . .           }  public void 
resetGServer()
{
   synch..(lockObj)
   {myServer = null;
   }
}}- A Fei ->





Hi,

I have one problem

In my action class , I am initilazing my graphic software server as a static
variable e.g.

public class ClsAction extends Action {


        // Start Intialize the instance of the graphics server

        public static GraphicsServer myServer =
ClsInitializeServer.getInitializeInstance();

        // End

        another methods(){
                . . .
                }


}

The code is executing perfectly OK, But I am not able to make "myserver"
object reference null when logging out of the application.

I tried calling the "myServer = null", but the next time I come to this java
class the "public static GraphicsServer myServer =
ClsInitializeServer.getInitializeInstance();"

does not seem to exceute, but is available to other parts of the program. I
think in struts it becomes the application level variable and does not null.
I am new , Plz help me how to make its reference null.



_________________________________________________________________
Explore the seven wonders of the world
http://search.msn.com/results.aspx?q=7+wonders+world&mkt=en-US&form=QBRE



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to