BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-23-2010, 01:43 AM   #1 (permalink)
New Member
 
Join Date: Jun 2009
Model: 9350
PIN: N/A
Carrier: no
Posts: 7
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Synchronize or parallel?

Please Login to Remove!

Synchronize or parallel?

Actually this is a java problem, but I dont know if different machine have their own behavior. So I decide to post question in Blackberry Forum.

The question is, I have to write a program in the Blackbery BOLD 9000 (Blackberry OS 4.6).
But my program is very slow to get and display the http request. So I think I can use different thread to solve the problem.
What will happen if I use two timer in a single function such as this:

public void sample(){
Timer timer1 = new Timer();
timer1.schedule(new RemindTask1(), 1000);
Timer timer2 = new Timer();
timer2.schedule(new RemindTask2(), 1000);
}
private class RemindTask1 extends TimerTask {
public void run() {
......
}
}
private class RemindTask2 extends TimerTask {
public void run() {
.......
}
}

Is that Task1 parallel run with Task2?
Offline  
Old 07-23-2010, 08:05 AM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

You don't want to use Timer as a background thread to perform blocking IO operations. Start your own Thread using the Thread class.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

MSA 10074137 ALTAIR PRO Single Gas Detector, Oxygen (O2)
$99.95
 MSA 10074137 ALTAIR PRO Single Gas Detector, Oxygen (O2)  picture(1PCS) ALTAIR04-900TR IC OFFLINE SWITCH PWM 16SOIC ALTAIR04 04-900
$2.13
(1PCS) ALTAIR04-900TR IC OFFLINE SWITCH PWM 16SOIC ALTAIR04 04-900 picture(5PCS) ALTAIR05T-800TR IC PRIMARY SWITCHING REG 16NSOIC ALTAIR05 05T
$9.29
(5PCS) ALTAIR05T-800TR IC PRIMARY SWITCHING REG 16NSOIC ALTAIR05 05T pictureMsa H2s Altair Pro Monitor
$11.99
Msa H2s Altair Pro Monitor pictureMSA Altair H2S Gas Detector 33 Months Left
$34.99
MSA Altair H2S Gas Detector 33 Months Left picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.