package cse308.swift.server.thread; public class SwiftThread extends Thread{ /** * The runtime this thread executes. */ private SwiftRunnable runtime = null; /** * Constructor to accept a SwiftRunnable object * @param initRuntime The SwiftRunnable object */ public SwiftThread (SwiftRunnable initRuntime) { this.runtime = initRuntime; } /** * The overridden run invocation */ @Override public void run() { if (runtime != null) runtime.run(); } /** * Attempts to gracefully stop the SwiftRunnable process in this thread if any * @return The success of stopping the SwiftRunnable process: boolean */ public boolean gracefulStop() { boolean success = false; if (runtime != null) { success = this.runtime.gracefulExit(); } return success; } /** * Attempts to gracefully stop the SwiftRunnable process in this thread if any * @return The sucess of interrupting this SwiftRunnable processs: boolean */ public boolean gracefulInterrupt() { boolean success = false; if (runtime != null) { success = this.runtime.gracefulInterrupt(); } return success; } }