That's exactly what I needed.  Thanks!

-Tom

On 7/11/06, Matt Chotin <[EMAIL PROTECTED]> wrote:

Do you want it to be a destination or just a class that is around at startup?  If it will be a destination you can set the scope to application for it and I believe it will get created as the server starts up.  If your class won't be a destination the traditional way to get a class loaded is to have a servlet kick it into gear.  You have the servlet get preloaded and then make sure that the servlet does whatever kickoff is needed.  Check the web.xml that we ship in flex.war, I believe the MessageBrokerServlet gets preloaded.  There may be other ways to do this as well but that's the one I've always used.

 

Matt

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Tom Bray
Sent: Tuesday, July 11, 2006 5:34 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: question about the Feed class in the dashboard sample

 

OK, so I figured out that Feed gets loaded because it's referred to in a remoting destination in remoting-config.xml, and I got my class running the same way.  However, I'm assuming this isn't the right way/place to setup FlexSession listeners and implement push logic via DataServiceTransaction.  Can you point me in the right direction?

Thanks,

Tom

On 7/11/06, Tom Bray <[EMAIL PROTECTED]> wrote:

I'm new to J2EE webapps, so please pardon my ignorance.  When does the Feed class get loaded/instantiated?  Does this happen automatically when the samples server is started?  I'm trying to do something similar in another app but my class doesn't seem to be loading.  I dropped my class in { server.root}/default/flex/WEB-INF/classes/test and was hoping it would magically start running when I restarted the server.  My goal is to figure out how to work with FlexSession and DataServiceTransaction and I figured I'd be able to do that from the class below.  Any help getting it up and running would be greatly appreciated.

//in C:\JRun4\servers\default\flex\WEB-INF\classes\test
package test;

import flex.messaging.FlexSession;
import flex.messaging.FlexSessionListener;
import flex.data.DataServiceTransaction;

public class MyTest implements FlexSessionListener
{
    private static FeedThread thread;
   
    public MyTest()
    {       
        thread = new FeedThread();
        thread.start();       
        FlexSession.addSessionCreatedListener(this);
    }
   
    public void sessionCreated( FlexSession session )
    {
        System.out.println( "sessionDestroyed!" );
    }       
   
    public void sessionDestroyed( FlexSession session )
    {
        System.out.println( "sessionDestroyed!" );
    }
   
    public static class FeedThread extends Thread
    {
        public boolean running = true;

        public void run()
        {
            while (running)
            {
                /*
                DataServiceTransaction dtx = DataServiceTransaction.begin( false );
                dtx.refreshFill( "myDest", new ArrayList() );
                */

                System.out.println( "running!" );
               
                try
                {
                    Thread.sleep(1000);
                }
                catch (InterruptedException e)
                {

                }
            }
        }
    }   

}

 


__._,_.___

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




__,_._,___

Reply via email to