Skip to content

Commit

Permalink
Documentation Update and Update Version Number
Browse files Browse the repository at this point in the history
  • Loading branch information
JaciBrunning committed Apr 26, 2015
1 parent 0959a78 commit 20a129b
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.settings
Original file line number Diff line number Diff line change
@@ -1 +1 @@
toast.version=1.2.0
toast.version=1.3.0
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import jaci.openrio.toast.core.ToastBootstrap;
import jaci.openrio.toast.core.command.cmd.CommandGroovyScript;
import jaci.openrio.toast.core.command.cmd.CommandThreadPool;
import jaci.openrio.toast.core.command.cmd.CommandUSB;

import java.util.List;
Expand Down Expand Up @@ -32,6 +33,7 @@ public static void init() {
private static void registerNatives() {
registerCommand(new CommandGroovyScript());
registerCommand(new CommandUSB());
registerCommand(new CommandThreadPool());
}

/**
Expand Down Expand Up @@ -71,7 +73,7 @@ private static void setupSim() {
Scanner scanner = new Scanner(System.in);
Thread thread = new Thread() {
public void run() {
Thread.currentThread().setName("Toast|SimulationCommands");
Thread.currentThread().setName("Toast|Sim");
try {
while (Thread.currentThread().isAlive()) {
parseMessage(scanner.nextLine());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@
import jaci.openrio.toast.core.shared.GlobalBlackboard;
import jaci.openrio.toast.core.thread.ToastThreadPool;

/**
* This command is used for on-the-fly Groovy Scripting. For the most part, this is useless, but it's both fun to play
* around with, useful for debugging, and freaking awesome.
*
* command_name: 'script'
* args:
* -c Execute the script in the {@link jaci.openrio.toast.core.thread.ToastThreadPool}, concurrently
*
* @author Jaci
*/
public class CommandGroovyScript extends FuzzyCommand {
@Override
public boolean shouldInvoke(String message) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package jaci.openrio.toast.core.command.cmd;

import jaci.openrio.toast.core.Toast;
import jaci.openrio.toast.core.command.AbstractCommand;
import jaci.openrio.toast.core.thread.ToastThreadPool;
import jaci.openrio.toast.lib.log.Logger;

import java.util.concurrent.ThreadPoolExecutor;

/**
* This command will simply echo data about the {@link jaci.openrio.toast.core.thread.ToastThreadPool} to the console.
* This is for debugging purposes
*
* command_name: 'threads'
* args: nil
*
* @author Jaci
*/
public class CommandThreadPool extends AbstractCommand {

@Override
public String getCommandName() {
return "threads";
}

@Override
public void invokeCommand(int argLength, String[] args, String command) {
ThreadPoolExecutor e = (ThreadPoolExecutor) ToastThreadPool.INSTANCE.getService();
Logger l = Toast.log();
l.info("*Toast Thread Pool Instance Data: ");
l.info(String.format("\t Active Threads: %d, Core Threads: %d", e.getPoolSize(), e.getCorePoolSize()));
l.info(String.format("\t Active Jobs: %d, Completed Jobs: %d, Total Jobs: %d", e.getActiveCount(), e.getCompletedTaskCount(), e.getTaskCount()));
l.info(String.format("\t Shutdown? %s, Terminated? %s, Terminating? %s", e.isShutdown(), e.isTerminated(), e.isTerminating()));
l.info("*End Toast Thread Pool Data");
}
}
14 changes: 14 additions & 0 deletions src/main/java/jaci/openrio/toast/core/command/cmd/CommandUSB.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;

/**
* This command is used for USB Mass Storage devices. This will be responsible for generating missing autorun files,
* dumping Toast Local data to a USB Drive and loading a backup from a USB drive.
*
* command_name: 'usb'
* args:
* generate Generates a toast_autorun.conf file on every invalid USB drive connected
* dump Dumps the local Toast files to a USB device.
* [drive_name] Specify a USB drive to dump to. If not set, it will dump to all drives.
* load Copy all Toast files from USB drives to the local Toast directory (reload backup)
* [drive_name] Specify a USB drive to load from. If not set, it will load from all drives.
*
* @author Jaci
*/
public class CommandUSB extends AbstractCommand {
@Override
public String getCommandName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public ToastThreadPool(String name, int size) {
* Initialize the Thread Pool. This is handled by Toast, do not call this yourself.
*/
public static void init() {
INSTANCE = new ToastThreadPool("Pool-Worker");
INSTANCE = new ToastThreadPool("Toast|Pool");
}

/**
Expand Down

0 comments on commit 20a129b

Please sign in to comment.