• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

fastest way fetch data through http

 
Sebastian Green
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im trying to build an none refresh application whos able to fetch data from internet the fastest way possible. The only way I can do is by refreshing with threads. Is there an other way?
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, it is tough because it depends on how much data will be sent, and the blocking that the IO occurs.

You can use a Timer periodically update the data at a time period that makes the data fetched to be a reasonable amount that doesn't take a lot of time. You could even have an Alarm set in the AMS that will wake up the MIDlet and fetch the data at a time when the user isn't using the device, and it could be like a nightly update, so that the next morning the user has the latest data.

Sometimes, if it is really important data that needs to be updated immediately you could use the Push Registry to receive a Push message that will load a MIDlet to update the data.

Other than that, you are limited to the limitations of J2ME.

Mark
 
Sebastian Green
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply. What im looking for is for the user to get the latest value as fast as possible, such as stock exchange. There, seconds are fatal.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There, seconds are fatal.


Well, then you might want to reconsider. I mean if you say having a Mobile device is quicker than the trader going to his office and getting a quote, then a couple of seconds that it might take the mobile device to access your Servlet/Web Service, or other mode would be OK, the data isn't large amounts.

But, you would have to develop it, and then profile it to see if the time is acceptable.

Mark
 
Sebastian Green
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get your point but Im not to blame, my boss wants it done. :roll:
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd say the fastest would be the simple Servlet, that accepts the Symbol, does a quick query, and returns the least amount of needed information, and that is all.

Mark
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, and have the call happen in a seperate thread, and display like a progress bar. Just having a progress bar makes it appear to be going faster than the app freezing till it gets the information.

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic