JSR-282 SI 23.0 ------------------------------------------------ Summary --------------------- Add getCurrentSO() to Scheduler. Specification References --------------------- This will add two new static methods to the Scheduler base class. Problem being Addressed --------------------- There is no general way to get a reference to the currently-executing schedulable object. getCurrentRealtimeThread() works if the SO is a RTT, but if it's and AEH, there is no easy way. Proposed Solution Summary --------------------- Add the following two methods to Scheduler: static public boolean isCallerAnSo(); static public Schedulable getCurrentSO(); Semantics --------------------- static public boolean isCallerAnSo(); If the caller is an SO (a real-time thread or an AEH), return true. IF the caller is a Java thread, return false. Static public Schedulable getCurrentSO() Return a reference to the caller's SO. If the caller is not an SO, throw ClassCastException. Discussion Points --------------------- Should we drop isCallerAnSO()? It can be determined without the method and without throwing an exception, e.g., if (Thread.currentThread instanceof RealtimeThread){ Schedulable currentSO = Scheduler.getCurrentSO(); } else { // we're not an SO, do something else. } Compatibility Issues --------------------- No "non-standard" issues.