Class Service

  • All Implemented Interfaces:
    java.lang.Runnable
    Direct Known Subclasses:
    AbstractServer

    public abstract class Service
    extends java.lang.Thread
    A class that facilitate service implementation
    Since:
    2005
    Version:
    $id: $
    Author:
    Wael Chatila
    • 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
    • Constructor Summary

      Constructors 
      Constructor Description
      Service()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void destroy​(java.lang.Object obj)  
      void init​(java.lang.Object obj)  
      protected boolean keepOn()  
      abstract void quit()  
      abstract void run()  
      void startService​(java.lang.Object obj)  
      void stopService​(java.lang.Object obj)  
      void stopService​(java.lang.Object obj, long millis)  
      void stopService​(java.lang.Object obj, java.lang.Long millis)
      Stops the service.
      • 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
    • Constructor Detail

      • Service

        public Service()
    • Method Detail

      • run

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

        public abstract void quit()
      • init

        public void init​(java.lang.Object obj)
      • destroy

        public void destroy​(java.lang.Object obj)
      • keepOn

        protected final boolean keepOn()
      • startService

        public void startService​(java.lang.Object obj)
      • stopService

        public final void stopService​(java.lang.Object obj,
                                      java.lang.Long millis)
        Stops the service. If a timeout is given and the service has still not gracefully been stopped after timeout ms the service is stopped by force.
        Parameters:
        obj -
        millis - value in ms
      • stopService

        public final void stopService​(java.lang.Object obj)
      • stopService

        public final void stopService​(java.lang.Object obj,
                                      long millis)