Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Parallelism in Java (http://www.chiefdelphi.com/forums/showthread.php?t=84854)

Egg 3141592654 31-03-2010 11:40

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?

FRC4ME 31-03-2010 12:54

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?

Jared Russell 31-03-2010 13:12

Re: Parallelism in Java
 
You should also look at the documentation for a TimerTask in the JavaDocs.

derekwhite 01-04-2010 08:46

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.

Egg 3141592654 01-04-2010 17:21

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?


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

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