Package ca.team3161.lib.robot.subsystem
Class AbstractPooledSubsystem
- java.lang.Object
-
- ca.team3161.lib.robot.subsystem.AbstractSubsystem
-
- ca.team3161.lib.robot.subsystem.AbstractPooledSubsystem
-
- All Implemented Interfaces:
Subsystem
- Direct Known Subclasses:
OneShotPooledSubsystem
,RepeatingPooledSubsystem
public abstract class AbstractPooledSubsystem extends AbstractSubsystem
Abstracts a system which uses resourceLocks and has some task (recurring or one-shot) to be performed. An example is PID control - monitor sensors and periodically set motor values based on this. Pooled subsystems share a common work queue, and so pooled subsystems should be careful to ensure that their tasks do not contain long-running operations (which includes any Thread.sleeps, Timers, while(true) loops, etc) or else other Subsystems will be unable to execute until the long-running operation has completed. If you need a Subsystem which is able to execute long-running operations without interfering with other Subsystems, use an IndependentSubsystem.- See Also:
AbstractIndependentSubsystem
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ca.team3161.lib.robot.subsystem.AbstractSubsystem
AbstractSubsystem.RunTask
-
-
Field Summary
-
Fields inherited from class ca.team3161.lib.robot.subsystem.AbstractSubsystem
job, resourceLocks, THREAD_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description AbstractPooledSubsystem()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.ScheduledExecutorService
getExecutorService()
Get the executor service which executes this subsystem's tasks.-
Methods inherited from class ca.team3161.lib.robot.subsystem.AbstractSubsystem
acquireResources, cancel, getJob, isCancelled, isScheduled, isStarted, releaseResources, require
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ca.team3161.lib.robot.subsystem.Subsystem
defineResources, isDone, start, task
-
-
-
-
Method Detail
-
getExecutorService
public java.util.concurrent.ScheduledExecutorService getExecutorService()
Description copied from class:AbstractSubsystem
Get the executor service which executes this subsystem's tasks. This service may or may not be shared with other subsystems; for Independent subsystems it is never shared, and for Pooled subsystems it is always shared.- Specified by:
getExecutorService
in classAbstractSubsystem
- Returns:
- the executor service.
- See Also:
AbstractIndependentSubsystem
,AbstractPooledSubsystem
-
-