Go to Post Never quit, never give up, never say die! - Cascade [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 31-03-2010, 11:40
Egg 3141592654's Avatar
Egg 3141592654 Egg 3141592654 is offline
Now a mentor, always a student
FRC #0810 (Mechanical Bulls)
Team Role: Programmer
 
Join Date: Feb 2010
Rookie Year: 2008
Location: Long Island
Posts: 53
Egg 3141592654 is on a distinguished road
Parallelism in Java

I am trying to move our team into a team that doesn't use the labview crutch anymore, and because i know OOP in java, it should be easy to mentor the younger teammates. I am recoding the robot from this year and it has a parallel periodic task. Do i create a new class and start a run method which would be created in the robotInit, or do i do something else.

On a side note, why does Netbeans 6.8 not have the FRC logo in the toolbar, while 6.7 does?
__________________
"The answers to the book of life are not found in the back." Charlie Brown

Software Mentor - Team Apex Robotics 5803

Lead Programmer - Team 810 Mechanical Bulls '09-'11
Reply With Quote
  #2   Spotlight this post!  
Unread 31-03-2010, 12:54
FRC4ME FRC4ME is offline
Registered User
FRC #0339
 
Join Date: Feb 2008
Rookie Year: 2007
Location: Fredericksburg, VA
Posts: 324
FRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant future
Re: Parallelism in Java

Create a class that implements interface Runnable, like this:

Code:
public class MyTask implements Runnable {
    public void run () {
        // Do stuff in here
    }
}
Then, in the main robot class, create a thread:

Code:
public Thread myThread = new Thread(new MyTask());
Start the thread in robotInit():

Code:
myThread.start(); // Will call MyTask.run() in a separate task
I think this is what you were thinking of already, no?
__________________
Go directly to queue. Do not pass pit.
Reply With Quote
  #3   Spotlight this post!  
Unread 31-03-2010, 13:12
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,077
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Parallelism in Java

You should also look at the documentation for a TimerTask in the JavaDocs.
Reply With Quote
  #4   Spotlight this post!  
Unread 01-04-2010, 08:46
derekwhite's Avatar
derekwhite derekwhite is offline
Java Virtual Machine Hacker
no team (FIRST@Oracle)
Team Role: Programmer
 
Join Date: May 2009
Rookie Year: 2009
Location: Burlington, MA
Posts: 127
derekwhite is on a distinguished road
Re: Parallelism in Java

Quote:
On a side note, why does Netbeans 6.8 not have the FRC logo in the toolbar, while 6.7 does?
Netbeans 6.8 show the FRC logo in 6.8 also. You probably need to reinstall the FRC modules after upgrading.
Reply With Quote
  #5   Spotlight this post!  
Unread 01-04-2010, 17:21
Egg 3141592654's Avatar
Egg 3141592654 Egg 3141592654 is offline
Now a mentor, always a student
FRC #0810 (Mechanical Bulls)
Team Role: Programmer
 
Join Date: Feb 2010
Rookie Year: 2008
Location: Long Island
Posts: 53
Egg 3141592654 is on a distinguished road
Re: Parallelism in Java

Yes, that is what i was initially thinking, minus the "implements Runable" part. Thank you.

As for the netbeans 6.8 not showing the FRC logo, it says that there is no jar file found. Is that jar file found in something else besides the 5 primary modules, and could manually installing these modules one at a time create an issue with this?
__________________
"The answers to the book of life are not found in the back." Charlie Brown

Software Mentor - Team Apex Robotics 5803

Lead Programmer - Team 810 Mechanical Bulls '09-'11
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This 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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Java Tutorial...? tomy Java 2 11-02-2010 21:15
Java Questions andrewmerrill Java 6 14-12-2009 11:08
Java team1512 Java 2 21-10-2009 06:36
Java vs. C++ nickmagus Programming 3 05-09-2009 19:23
**FIRST EMAIL**/Java and Orbit Balls *****JAVA DISCUSSION*** Pjohn1959 Programming 37 31-08-2009 15:55


All times are GMT -5. The time now is 09:42.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi