Skip to content

Commit 20a129b

Browse files
committed
Documentation Update and Update Version Number
1 parent 0959a78 commit 20a129b

6 files changed

Lines changed: 65 additions & 3 deletions

File tree

build.settings

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
toast.version=1.2.0
1+
toast.version=1.3.0

src/main/java/jaci/openrio/toast/core/command/CommandBus.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import jaci.openrio.toast.core.ToastBootstrap;
44
import jaci.openrio.toast.core.command.cmd.CommandGroovyScript;
5+
import jaci.openrio.toast.core.command.cmd.CommandThreadPool;
56
import jaci.openrio.toast.core.command.cmd.CommandUSB;
67

78
import java.util.List;
@@ -32,6 +33,7 @@ public static void init() {
3233
private static void registerNatives() {
3334
registerCommand(new CommandGroovyScript());
3435
registerCommand(new CommandUSB());
36+
registerCommand(new CommandThreadPool());
3537
}
3638

3739
/**
@@ -71,7 +73,7 @@ private static void setupSim() {
7173
Scanner scanner = new Scanner(System.in);
7274
Thread thread = new Thread() {
7375
public void run() {
74-
Thread.currentThread().setName("Toast|SimulationCommands");
76+
Thread.currentThread().setName("Toast|Sim");
7577
try {
7678
while (Thread.currentThread().isAlive()) {
7779
parseMessage(scanner.nextLine());

src/main/java/jaci/openrio/toast/core/command/cmd/CommandGroovyScript.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@
77
import jaci.openrio.toast.core.shared.GlobalBlackboard;
88
import jaci.openrio.toast.core.thread.ToastThreadPool;
99

10+
/**
11+
* This command is used for on-the-fly Groovy Scripting. For the most part, this is useless, but it's both fun to play
12+
* around with, useful for debugging, and freaking awesome.
13+
*
14+
* command_name: 'script'
15+
* args:
16+
* -c Execute the script in the {@link jaci.openrio.toast.core.thread.ToastThreadPool}, concurrently
17+
*
18+
* @author Jaci
19+
*/
1020
public class CommandGroovyScript extends FuzzyCommand {
1121
@Override
1222
public boolean shouldInvoke(String message) {
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package jaci.openrio.toast.core.command.cmd;
2+
3+
import jaci.openrio.toast.core.Toast;
4+
import jaci.openrio.toast.core.command.AbstractCommand;
5+
import jaci.openrio.toast.core.thread.ToastThreadPool;
6+
import jaci.openrio.toast.lib.log.Logger;
7+
8+
import java.util.concurrent.ThreadPoolExecutor;
9+
10+
/**
11+
* This command will simply echo data about the {@link jaci.openrio.toast.core.thread.ToastThreadPool} to the console.
12+
* This is for debugging purposes
13+
*
14+
* command_name: 'threads'
15+
* args: nil
16+
*
17+
* @author Jaci
18+
*/
19+
public class CommandThreadPool extends AbstractCommand {
20+
21+
@Override
22+
public String getCommandName() {
23+
return "threads";
24+
}
25+
26+
@Override
27+
public void invokeCommand(int argLength, String[] args, String command) {
28+
ThreadPoolExecutor e = (ThreadPoolExecutor) ToastThreadPool.INSTANCE.getService();
29+
Logger l = Toast.log();
30+
l.info("*Toast Thread Pool Instance Data: ");
31+
l.info(String.format("\t Active Threads: %d, Core Threads: %d", e.getPoolSize(), e.getCorePoolSize()));
32+
l.info(String.format("\t Active Jobs: %d, Completed Jobs: %d, Total Jobs: %d", e.getActiveCount(), e.getCompletedTaskCount(), e.getTaskCount()));
33+
l.info(String.format("\t Shutdown? %s, Terminated? %s, Terminating? %s", e.isShutdown(), e.isTerminated(), e.isTerminating()));
34+
l.info("*End Toast Thread Pool Data");
35+
}
36+
}

src/main/java/jaci/openrio/toast/core/command/cmd/CommandUSB.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,20 @@
1313
import java.nio.file.Files;
1414
import java.nio.file.StandardCopyOption;
1515

16+
/**
17+
* This command is used for USB Mass Storage devices. This will be responsible for generating missing autorun files,
18+
* dumping Toast Local data to a USB Drive and loading a backup from a USB drive.
19+
*
20+
* command_name: 'usb'
21+
* args:
22+
* generate Generates a toast_autorun.conf file on every invalid USB drive connected
23+
* dump Dumps the local Toast files to a USB device.
24+
* [drive_name] Specify a USB drive to dump to. If not set, it will dump to all drives.
25+
* load Copy all Toast files from USB drives to the local Toast directory (reload backup)
26+
* [drive_name] Specify a USB drive to load from. If not set, it will load from all drives.
27+
*
28+
* @author Jaci
29+
*/
1630
public class CommandUSB extends AbstractCommand {
1731
@Override
1832
public String getCommandName() {

src/main/java/jaci/openrio/toast/core/thread/ToastThreadPool.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public ToastThreadPool(String name, int size) {
5252
* Initialize the Thread Pool. This is handled by Toast, do not call this yourself.
5353
*/
5454
public static void init() {
55-
INSTANCE = new ToastThreadPool("Pool-Worker");
55+
INSTANCE = new ToastThreadPool("Toast|Pool");
5656
}
5757

5858
/**

0 commit comments

Comments
 (0)