From 8ae65d1bdd5253dec9d2dcf92b56b97c85eac208 Mon Sep 17 00:00:00 2001 From: SquidDev Date: Thu, 22 Nov 2018 12:48:06 +0000 Subject: [PATCH] A couple of minor cleanups on the last commit - Remove a redundant logger - Provide a getter for the ComputerCraft thread group. This allows us to monitor child threads within prometheus. - Replace a deprecated call with a fastutils alternative. --- .../computercraft/core/lua/CobaltLuaMachine.java | 1 - .../computercraft/core/tracking/ComputerTracker.java | 2 +- .../dan200/computercraft/shared/util/ThreadUtils.java | 10 ++++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/dan200/computercraft/core/lua/CobaltLuaMachine.java b/src/main/java/dan200/computercraft/core/lua/CobaltLuaMachine.java index e933397f5f..e122407bfd 100644 --- a/src/main/java/dan200/computercraft/core/lua/CobaltLuaMachine.java +++ b/src/main/java/dan200/computercraft/core/lua/CobaltLuaMachine.java @@ -129,7 +129,6 @@ private void handleSoftAbort() throws LuaError Tracking.addValue( m_computer, TrackingField.COROUTINES_DISPOSED, 1 ); } } ); - ComputerCraft.log.info( "Thread pool: " + coroutines ); } ) .build(); diff --git a/src/main/java/dan200/computercraft/core/tracking/ComputerTracker.java b/src/main/java/dan200/computercraft/core/tracking/ComputerTracker.java index 8a11c0e1aa..1c0db5d470 100644 --- a/src/main/java/dan200/computercraft/core/tracking/ComputerTracker.java +++ b/src/main/java/dan200/computercraft/core/tracking/ComputerTracker.java @@ -106,7 +106,7 @@ public long get( TrackingField field ) synchronized( fields ) { - return fields.get( field ); + return fields.getLong( field ); } } diff --git a/src/main/java/dan200/computercraft/shared/util/ThreadUtils.java b/src/main/java/dan200/computercraft/shared/util/ThreadUtils.java index 197a608a18..7950503f97 100644 --- a/src/main/java/dan200/computercraft/shared/util/ThreadUtils.java +++ b/src/main/java/dan200/computercraft/shared/util/ThreadUtils.java @@ -21,6 +21,16 @@ private ThreadUtils() { } + /** + * Get the base thread group, that all off-thread ComputerCraft activities are run on. + * + * @return The ComputerCraft group. + */ + public static ThreadGroup group() + { + return baseGroup; + } + /** * Construct a group under ComputerCraft's shared group *