Re: Re: Re: Development Framework
Stephen Jackson <[email protected]>
| Newsgroups | gmane.comp.java.openamf.user |
|---|---|
| Message-ID | <1099785788.2630.2.camel@vaquero> |
Certainly looks cleaner. Probably use an Observer/Observable notification when the data is updated to push the new data to the client using XMLSocket. On Sat, 2004-11-06 at 16:07, Ian Pojman wrote: > wouldn't opening a ServerSocket and using XMLSocket on the flash side > be most efficient? > > > On Fri, 05 Nov 2004 23:45:39 -0500, Stephen Jackson > <[email protected]> wrote: > > I don't know anything but the look and feel of your app. but instead of > > polling, perhaps this is something to think about. > > > > Perhaps what you could do is separate out the piece of the application that > > requires so much communication into it's own .swf. Then that .swf makes > > the call to the app to request the potentially modified data. Add the thread > > that makes the request to a List and notifiy the list when data has been > > modified, Add the thread to a List which would own the threadLock to that > > object. Then if the data is modified, notify the owner of the list (some > > sort of JMX component - Singleton). It would update the data, release the > > threadlock. This way you only have a single thread polling which some sort > > of thread that owns the list and the original thread lock. > > > > Based on the type of data you are asking for use the Observer/Observable > > pattern to push your request on a List until the object is notified of a > > modification. Then return the request. > > > > Apparently the end user must be siting there waiting to see constant > > changes so it would be constantly connected without constantly asking for > > the data.(pop up)? > > > > I attached the working ThreadLock object I have used in the past. The > > concept is there. > > > > Just an idea, would have to prototype it. > > > > public class RequestDataChange{ > > private static RequestDataChange = new RequestDataChange(); > > private static Notify notify = new Notify(); > > { > > new Thread(notify).run(); > > } > > > > //simplify and make a single for the example > > //JBOSS JMX components work very well > > public static RequestDataChange getInstance(){ > > return dataChange; > > } > > > > //the request thread would call this method > > public waitForUpdate( Data data ){ > > try{ > > notify.addData(Data); > > //will block on this until notify thread frees the original > > thread lock > > data.getThreadLock(); > > }finally{ > > data.freeThreadLock(); > > } > > } > > > > //a different thread would update the data > > public void updateData( Object object ){ > > notify.updateData(object); > > } > > > > class Notify implements Runnable { > > private List waitingRoom = new ArrayList(); > > > > public void addData( Data data ){ > > > > watingRoom.add(data); > > data.getThreadLock(); > > } > > > > public void run(){ > > //check > > } > > > > public updateData( String key, Object newData ){ > > //iterate through modifiy the data and release. > > Iterator iter = waitingRoom.iterator(); > > while(){ > > //update the data > > //original thread resumes > > data.freeThreadLock(); > > } > > } > > } > > } > > > > public class Data { > > private HashMap data = new HashMap(); > > private ThreadLock lock = new ThreadLock(); > > private boolean dataModFlag = false; > > public void lock(){ > > lock.getThreadLock(); > > } > > > > public void free(){ > > lock.freeThreadLock(); > > } > > > > public boolean getDatModFlag(){ > > return this.dataModFlag; > > } > > > > public void setDataModFlag( boolean flag ){ > > this.dataModFlag = flag; > > > > > > } > > } > > > > On Fri, 2004-11-05 at 00:29, Arif Amirani wrote: > > Hey Stephen, I have like 1k clients connected to a DB over OpenAMF and > > Tomcat on either ends (obviously with a Flash client :-)). Now each client > > can make changes to the DB and this needs to be reflected automatically for > > all the clients. Now there are 2 use cases to this: 1. Only 1 client is > > connected to the DB and hence the client unneccessary polls for changes. 2. > > 1k of them connect simultaneously and data changes changes rapidly so the > > polling is justified. In an event based system, on each data change every > > client would get notified by the server. So no changes no events no requests > > made. But in poll based system my 1k clients make 1k requests every 2 > > seconds (thats the frequency i intend to set). Thats too much! So in essence > > as i posted earlier we need an intelligent polling system and the interval > > should be variable. Earlier post sorry to repost. "Seems like polling may be > > the way to go but if I have like 1k clients polling unneccessarily to a > > potentially static data server which may have a sudden data change once in a > > while, it does not sound seriously lucrative. I was thinking of > > designing/implementing an intelligent polling system which attaches a > > probability to the next poll. Depending on this probability the client will > > automatically deduce when to poll next, but I guess such a solution is not > > very generic and scalable. I just want to finally have a system that is as > > efficent as event based models and can be implemented using polling." Would > > such a model actually work or im just thinkin too much math :) Thanks, Arif > > Amirani. "Stephen Jackson" <[email protected]> wrote in > > message news:1099616593.2655.0.camel@vaquero... What are you trying to > > solve? On Mon, 2004-11-01 at 04:19, Arif Amirani wrote: "is there no way to > > send a message from server to client?" Can somebody please comment on this? > > I am facing imminent polling code to be written if this goes unanswered :) > > Thanks, Arif Amirani "Ian Pojman" <[email protected]> wrote in message > > news:[email protected]... EJBs are good for > > client/server stuff, for one.... its not the programming APIs which you need > > it for as much as leveraging the functionality of an EJB container, that is, > > writing simple EJB POJOs and having the magic 'be worked' underneath you. no > > rmi programming, pooling, etc. I guess using OpenAMF is asking for better > > performance than SOAP... that's one of the reasons why I'll most likely > > stick with OpenAMF... is there no way to send a message from server to > > client? On Sun, 31 Oct 2004 19:49:02 +0100, Franois Le Lay <[email protected]> > > wrote: > Yeah actually, the idea is to come up with a richer set of examples > > than > the ones provided in openAMF. As you mentioned it, I also tend to > > think > that one can achieve better performance by avoiding the use of > > > persistance frameworks or EJBs whenever they don't fit the purpose. > > > Actually has anyone here used EJBs rather than JavaBeans/POJOs and for > > > what specific task? > > > > Ian Pojman wrote: > > >I use hibernate and > > various j2ee stuff but I do not advocate the use > >of JBoss or JDO or > > commons stuff. one can do a lot better without a > >bunch of bloaty > > frameworks... > > > >really nothing much of j2ee is germane because you can > > do whatever you > >want in your services. > > > >I would rather see someone > > show some patterns in using openamf, > >examples of more complex AMF > > conversations. > > > >/ian > > > >On Sun, 31 Oct 2004 18:15:33 +0100, > > Franois Le Lay <[email protected]> wrote: > > > > > >>Hi all, > >> > >>I would > > like to write a "getting started" doc dealing with the joint use > >>of > > OpenAMF+AS2+JBoss+Eclipse+(JDBC, Commons.DbUtils, JDO, Hibernate). So > > > >>right now I need to know if some of you are using this combiantion of > > > >>tools as their base framework? Could you describe the way you work in a > > > >>few simple steps? I know it sounds like I should be more specific about > > > >>it, but we can get into details later. > >> > >>Cheers, > >>Franois > >> > > > >> > >> > > ------------------------------------------------------- > This > > SF.Net email is sponsored by: > Sybase ASE Linux Express Edition - download > > now for FREE > LinuxWorld Reader's Choice Award Winner for best database on > > Linux. > http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click > > > _______________________________________________ > Openamf-user mailing list > > > [email protected] > > > https://lists.sourceforge.net/lists/listinfo/openamf-user > > > ------------------------------------------------------- This SF.Net email is > > sponsored by: Sybase ASE Linux Express Edition - download now for FREE > > LinuxWorld Reader's Choice Award Winner for best database on Linux. > > http://ads.osdn.com/?ad_idU88&alloc_id065&op=ick > > ------------------------------------------------------- This SF.Net email is > > sponsored by: Sybase ASE Linux Express Edition - download now for FREE > > LinuxWorld Reader's Choice Award Winner for best database on Linux. > > http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click > > _______________________________________________ Openamf-user mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/openamf-user > > ------------------------------------------------------- This SF.Net email is > > sponsored by: Sybase ASE Linux Express Edition - download now for FREE > > LinuxWorld Reader's Choice Award Winner for best database on Linux. > > http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click > > _______________________________________________ Openamf-user mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/openamf-user > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: > Sybase ASE Linux Express Edition - download now for FREE > LinuxWorld Reader's Choice Award Winner for best database on Linux. > http://ads.osdn.com/?ad_idU88&alloc_id065&op=click > _______________________________________________ > Openamf-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/openamf-user