Class OperationThread

  • All Implemented Interfaces:
    java.lang.Runnable

    public class OperationThread
    extends java.lang.Thread
    This class is for model sharer developer only, you rarely need to use this class.

    Available in ZK PE and ZK EE.

    OperationThread has only one instance in each desktop, it store it-self in the desktop by setAttribute. It create and monitor the OperationQueue, if there are any operation in queue, it will consume it.

    Since:
    3.0.0
    Author:
    Dennis.Chen
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.lang.Thread

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • Field Summary

      • Fields inherited from class java.lang.Thread

        MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void destroyWith​(Desktop desktop)
      Terminate a OperationThread which is stored in desktop and clear it.
      static OperationQueue getQueue​(Desktop desktop)
      Get the OperationQueue of OperationThread, It is check is there any OperationThread exist in desktop.
      boolean isRunning()
      Is this thread still running
      void run()  
      void terminate()
      Terminate this thread. thread will be stopped after last run trip.
      • Methods inherited from class java.lang.Thread

        activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • getQueue

        public static OperationQueue getQueue​(Desktop desktop)
        Get the OperationQueue of OperationThread, It is check is there any OperationThread exist in desktop. If no, create one ,start it and store in desktop, then return thread's operation queue. If yes, return operation queue directly. There is only one OperationThread in each desktop.
        Parameters:
        desktop - the associated desktop
        Returns:
        a queue which associate to desktop
      • destroyWith

        public static void destroyWith​(Desktop desktop)
        Terminate a OperationThread which is stored in desktop and clear it.
        Parameters:
        desktop - the associated desktop
      • isRunning

        public boolean isRunning()
        Is this thread still running
        Returns:
        true is thread still running
      • terminate

        public void terminate()
        Terminate this thread. thread will be stopped after last run trip.
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
        Overrides:
        run in class java.lang.Thread