BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 07-23-2010, 01:43 AM   #1
fenixlam
New Member
 
Join Date: Jun 2009
Model: 9350
PIN: N/A
Carrier: no
Posts: 7
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
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
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



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


●VINTAGE MAC Tools XU6 13MM  3/8

●VINTAGE MAC Tools XU6 13MM 3/8" Drive 6 Point Universal Swivel Socket Tight

$12.50



Vintage MAC Tools Double Flaring Tool Kit w Case 3/16

Vintage MAC Tools Double Flaring Tool Kit w Case 3/16" - 1/2" SAE Tubing Cutter

$32.99



Vintage Mac Tools Black Frame Mirror Lens Safety Glasses USA picture

Vintage Mac Tools Black Frame Mirror Lens Safety Glasses USA

$31.88



Vintage Mac Tools Central 6628 Stainless Steel Dial Caliper, 0-6

Vintage Mac Tools Central 6628 Stainless Steel Dial Caliper, 0-6"/0-150mm Range

$75.00



Vintage Mac Warehouse  3.5” Floppy Disk Solar Powered Calculator Company Swag picture

Vintage Mac Warehouse 3.5” Floppy Disk Solar Powered Calculator Company Swag

$74.00



Vintage Mac Tools AW343 Series 1/2 Pneumatic Impact Driver  picture

Vintage Mac Tools AW343 Series 1/2 Pneumatic Impact Driver

$40.00







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