[flexcoders] Re: How can I unload or delete a remoteObject reference manually
Stateful objects shiver... cringe... You can destroy a J2EE session using session.invalidate(); In say your own servlet or JSP page. This will destroy the session and unbind any objects bound to it. It will also however destroy your J2EE authentication session effectively logging you out. You could also iterate over all the objects in the session (also in a servlet or jsp) and remove a specific object session.removeAttribute(String name); Assuming you could identify it by name. Personaly, I would just avoid designs that require stateful servants. -- Dave Wolf Cynergy Systems, Inc. Macromedia Flex Alliance Partner http://www.cynergysystems.com Email: [EMAIL PROTECTED] Office: 866-CYNERGY --- In flexcoders@yahoogroups.com, Matt Chotin [EMAIL PROTECTED] wrote: If you have a stateful object on the server that means it is stored in the server's Session object. The connection to RemoteObject is made over HTTP so there's no real reference to it other than what the Session has. When the session times out the object will go away. If you want to kill the session earlier you'll need to do that in an app-server specific manner (I believe Tomcat does have a way to kill the session somehow but it's not immediately obvious). I'm pretty sure there's no generic J2EE way to do it. You sure you need the RemoteObject to be stateful? Matt -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of ping2peng Sent: Monday, December 19, 2005 1:14 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] How can I unload or delete a remoteObject reference manually Scenario is my flex app used a java bean with a remoteobject id foo, if my judgement is correct, calling unloadMovie() will destroy the flashmovie and its reference. 1. how can i release the remoteobject reference manually, 2. releasing a reference or destroying on declared stateful-class javabean. FLEX 1.5 System Spec. jboss4.0.3sp1 EJB3-Clustered with tomcat 5.5 container on bea-jrockit jdk1.5 under GNU/linux system kernel 2.6.12-10-686-smp -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links Yahoo! Groups Sponsor ~-- 1.2 million kids a year are victims of human trafficking. Stop slavery. http://us.click.yahoo.com/.QUssC/izNLAA/TtwFAA/nhFolB/TM ~- -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Re: How can I unload or delete a remoteObject reference manually
It is a little confusing about how i described the problem. the scenario is a java-bean named Foo.java is a simple bean that consume a Facade EJB-SLSB, this Foo.java is registered on the flex-config as a named=FooSrv, remote-object with stateful-class. We all basically know that when there are no references on an object it is directly thrown into a trash-bin for GC to collect but when i tried to call unloadMovie() where basically destroys the flex-app together with the reference to the FooSrv-remoteObject, and calling the controller-javabean to invalidate session using flashgateway.getSession, It do log-me out remove some initialized stuff for session-and-jaas handling but the problem is that the reference of the flex-app to the FooSrv isn't garbage collected, this is not a problem when I make the FooSrv flex-config into a stateless-class, it naturally release-references lock but having like 13 instances on a method-invocation giving a lot processing and eating too much traffic on the network isn't good. I also tried using a local-server-state-session-type bean with a bunch of ThreadLocals for this, and it worked, but there is a larger problem, coz re-coding and redesigning would eat too much time, developing only the cool-flex-presentation over presentation layer. is there something like fooSrvInstance = null; to release the reference from the flex-app and unloadMovie() this would kill it? I'm using one stage where i load and unload flash-movies and flex-app at the same time, the application is quite cool but on the backend-it-hurts. Yahoo! Groups Sponsor ~-- 1.2 million kids a year are victims of human trafficking. Stop slavery. http://us.click.yahoo.com/.QUssC/izNLAA/TtwFAA/nhFolB/TM ~- -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Re: How can I unload or delete a remoteObject reference manually
My suggestion is this. Write a very simple JSP page called say cleanupsession.jsp. Inside that do something like this: % @page language=java % String[]keys = session.getValueNames(); for(int i=0; ikeys.length; i++) { session.removeAttribute(keys[i]); } session.invalidate(); Now, when you call that JSP it will empty the session object of all objects in its Map then destroy the session itself. Call this JSP page from the Flex UI. That will remove all references to stateful classes, then invalidate the session. What you were seeing was effectively a memory leak where the session couldnt actually be garbage collected because it held a reference to the remote class. You might also have to add a method to the remote class to release any references to objects it might have. Please keep in mind that for the Java GC to do its job, it must create an object-map and make sure *every* class in the map has a reference count of zero before it can get collected. Let me know how that goes. -- Dave Wolf Cynergy Systems, Inc. Macromedia Flex Alliance Partner http://www.cynergysystems.com Email: [EMAIL PROTECTED] Office: 866-CYNERGY --- In flexcoders@yahoogroups.com, ping2peng [EMAIL PROTECTED] wrote: It is a little confusing about how i described the problem. the scenario is a java-bean named Foo.java is a simple bean that consume a Facade EJB-SLSB, this Foo.java is registered on the flex-config as a named=FooSrv, remote-object with stateful-class. We all basically know that when there are no references on an object it is directly thrown into a trash-bin for GC to collect but when i tried to call unloadMovie() where basically destroys the flex-app together with the reference to the FooSrv-remoteObject, and calling the controller-javabean to invalidate session using flashgateway.getSession, It do log-me out remove some initialized stuff for session-and-jaas handling but the problem is that the reference of the flex-app to the FooSrv isn't garbage collected, this is not a problem when I make the FooSrv flex-config into a stateless-class, it naturally release-references lock but having like 13 instances on a method-invocation giving a lot processing and eating too much traffic on the network isn't good. I also tried using a local-server-state-session-type bean with a bunch of ThreadLocals for this, and it worked, but there is a larger problem, coz re-coding and redesigning would eat too much time, developing only the cool-flex-presentation over presentation layer. is there something like fooSrvInstance = null; to release the reference from the flex-app and unloadMovie() this would kill it? I'm using one stage where i load and unload flash-movies and flex-app at the same time, the application is quite cool but on the backend-it-hurts. Yahoo! Groups Sponsor ~-- Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life. http://us.click.yahoo.com/KIlPFB/vlQLAA/TtwFAA/nhFolB/TM ~- -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Re: How can I unload or delete a remoteObject reference manually
OMG, thank you for this, if you didn't suggest this jsp i haven't noticed that I'm the most stupid person on the planet, the root cause of the problem was just not restarting the other appserv on the cluster. i was actually accessing the old copies. Thank You very much... it was my mistake. --- In flexcoders@yahoogroups.com, Dave Wolf [EMAIL PROTECTED] wrote: My suggestion is this. Write a very simple JSP page called say cleanupsession.jsp. Inside that do something like this: % @page language=java % String[]keys = session.getValueNames(); for(int i=0; ikeys.length; i++) { session.removeAttribute(keys[i]); } session.invalidate(); Now, when you call that JSP it will empty the session object of all objects in its Map then destroy the session itself. Call this JSP page from the Flex UI. That will remove all references to stateful classes, then invalidate the session. What you were seeing was effectively a memory leak where the session couldnt actually be garbage collected because it held a reference to the remote class. You might also have to add a method to the remote class to release any references to objects it might have. Please keep in mind that for the Java GC to do its job, it must create an object-map and make sure *every* class in the map has a reference count of zero before it can get collected. Let me know how that goes. -- Dave Wolf Cynergy Systems, Inc. Macromedia Flex Alliance Partner http://www.cynergysystems.com Email: [EMAIL PROTECTED] Office: 866-CYNERGY --- In flexcoders@yahoogroups.com, ping2peng [EMAIL PROTECTED] wrote: It is a little confusing about how i described the problem. the scenario is a java-bean named Foo.java is a simple bean that consume a Facade EJB-SLSB, this Foo.java is registered on the flex-config as a named=FooSrv, remote-object with stateful-class. We all basically know that when there are no references on an object it is directly thrown into a trash-bin for GC to collect but when i tried to call unloadMovie() where basically destroys the flex-app together with the reference to the FooSrv-remoteObject, and calling the controller-javabean to invalidate session using flashgateway.getSession, It do log-me out remove some initialized stuff for session-and-jaas handling but the problem is that the reference of the flex-app to the FooSrv isn't garbage collected, this is not a problem when I make the FooSrv flex-config into a stateless-class, it naturally release-references lock but having like 13 instances on a method-invocation giving a lot processing and eating too much traffic on the network isn't good. I also tried using a local-server-state-session-type bean with a bunch of ThreadLocals for this, and it worked, but there is a larger problem, coz re-coding and redesigning would eat too much time, developing only the cool-flex-presentation over presentation layer. is there something like fooSrvInstance = null; to release the reference from the flex-app and unloadMovie() this would kill it? I'm using one stage where i load and unload flash-movies and flex-app at the same time, the application is quite cool but on the backend-it-hurts. Yahoo! Groups Sponsor ~-- AIDS in India: A lurking bomb. Click and help stop AIDS now. http://us.click.yahoo.com/VpTY2A/lzNLAA/yQLSAA/nhFolB/TM ~- -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Re: How can I unload or delete a remoteObject reference manually
Glad to help! Clusters turn something complex to understand like multi-threaded programming into something so mind boggling as to make your head spin. The J2EE/server/deployment side of Flex is something that will be very new to a lot of folks from the Flash world too. -- Dave Wolf Cynergy Systems, Inc. Macromedia Flex Alliance Partner http://www.cynergysystems.com Email: [EMAIL PROTECTED] Office: 866-CYNERGY --- In flexcoders@yahoogroups.com, ping2peng [EMAIL PROTECTED] wrote: OMG, thank you for this, if you didn't suggest this jsp i haven't noticed that I'm the most stupid person on the planet, the root cause of the problem was just not restarting the other appserv on the cluster. i was actually accessing the old copies. Thank You very much... it was my mistake. --- In flexcoders@yahoogroups.com, Dave Wolf [EMAIL PROTECTED] wrote: My suggestion is this. Write a very simple JSP page called say cleanupsession.jsp. Inside that do something like this: % @page language=java % String[]keys = session.getValueNames(); for(int i=0; ikeys.length; i++) { session.removeAttribute(keys[i]); } session.invalidate(); Now, when you call that JSP it will empty the session object of all objects in its Map then destroy the session itself. Call this JSP page from the Flex UI. That will remove all references to stateful classes, then invalidate the session. What you were seeing was effectively a memory leak where the session couldnt actually be garbage collected because it held a reference to the remote class. You might also have to add a method to the remote class to release any references to objects it might have. Please keep in mind that for the Java GC to do its job, it must create an object-map and make sure *every* class in the map has a reference count of zero before it can get collected. Let me know how that goes. -- Dave Wolf Cynergy Systems, Inc. Macromedia Flex Alliance Partner http://www.cynergysystems.com Email: [EMAIL PROTECTED] Office: 866-CYNERGY --- In flexcoders@yahoogroups.com, ping2peng [EMAIL PROTECTED] wrote: It is a little confusing about how i described the problem. the scenario is a java-bean named Foo.java is a simple bean that consume a Facade EJB-SLSB, this Foo.java is registered on the flex-config as a named=FooSrv, remote-object with stateful-class. We all basically know that when there are no references on an object it is directly thrown into a trash-bin for GC to collect but when i tried to call unloadMovie() where basically destroys the flex-app together with the reference to the FooSrv-remoteObject, and calling the controller-javabean to invalidate session using flashgateway.getSession, It do log-me out remove some initialized stuff for session-and-jaas handling but the problem is that the reference of the flex-app to the FooSrv isn't garbage collected, this is not a problem when I make the FooSrv flex-config into a stateless-class, it naturally release-references lock but having like 13 instances on a method-invocation giving a lot processing and eating too much traffic on the network isn't good. I also tried using a local-server-state-session-type bean with a bunch of ThreadLocals for this, and it worked, but there is a larger problem, coz re-coding and redesigning would eat too much time, developing only the cool-flex-presentation over presentation layer. is there something like fooSrvInstance = null; to release the reference from the flex-app and unloadMovie() this would kill it? I'm using one stage where i load and unload flash-movies and flex-app at the same time, the application is quite cool but on the backend-it-hurts. Yahoo! Groups Sponsor ~-- Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life. http://us.click.yahoo.com/KIlPFB/vlQLAA/TtwFAA/nhFolB/TM ~- -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/