Package edu.jas.util

Class Broadcaster

  • All Implemented Interfaces:
    java.lang.Runnable

    class Broadcaster
    extends java.lang.Thread
    Thread for broadcasting all incoming objects to the list clients.
    • Nested Class Summary

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

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

      Fields 
      Modifier and Type Field Description
      private java.util.List bcaster  
      private SocketChannel channel  
      private Counter listElem  
      private static org.apache.logging.log4j.Logger logger  
      private java.util.SortedMap<Counter,​java.lang.Object> theList  
      • Fields inherited from class java.lang.Thread

        MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void broadcast​(java.lang.Object o)
      broadcast.
      void closeChannel()
      closeChannel.
      void run()
      run.
      void sendChannel​(java.lang.Object n, java.lang.Object o)
      sendChannel.
      java.lang.String toString()
      toString.
      • Methods inherited from class java.lang.Thread

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

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

      • logger

        private static final org.apache.logging.log4j.Logger logger
      • bcaster

        private final java.util.List bcaster
      • listElem

        private Counter listElem
      • theList

        private final java.util.SortedMap<Counter,​java.lang.Object> theList
    • Constructor Detail

      • Broadcaster

        public Broadcaster​(SocketChannel s,
                           java.util.List p,
                           Counter le,
                           java.util.SortedMap<Counter,​java.lang.Object> sm)
        Broadcaster.
        Parameters:
        s - SocketChannel to use.
        p - list of broadcasters.
        le - counter
        sm - SortedMap with counter value pairs.
    • Method Detail

      • closeChannel

        public void closeChannel()
        closeChannel.
      • sendChannel

        public void sendChannel​(java.lang.Object n,
                                java.lang.Object o)
                         throws java.io.IOException
        sendChannel.
        Parameters:
        n - counter.
        o - value.
        Throws:
        java.io.IOException
      • broadcast

        public void broadcast​(java.lang.Object o)
        broadcast.
        Parameters:
        o - object to store and send.
      • run

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

        public java.lang.String toString()
        toString.
        Overrides:
        toString in class java.lang.Thread
        Returns:
        a string representation of this.