Package edu.jas.util

Class ChannelFactory

java.lang.Object
java.lang.Thread
edu.jas.util.ChannelFactory
All Implemented Interfaces:
Runnable

public class ChannelFactory extends Thread
ChannelFactory implements a symmetric and non blocking way of setting up sockets on the client and server side. The constructor sets up a ServerSocket and accepts and stores any Socket creation requests from clients. The created Sockets can the be retrieved from the store without blocking. Refactored for java.util.concurrent.
See Also:
  • Field Details

    • logger

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

      private static final boolean debug
    • DEFAULT_PORT

      public static final int DEFAULT_PORT
      default port of socket.
      See Also:
    • port

      private final int port
      port of socket.
    • buf

      private final BlockingQueue<SocketChannel> buf
      BoundedBuffer for sockets.
    • srv

      private volatile ServerSocket srv
      local server socket.
    • srvrun

      private volatile boolean srvrun
      is local server up and running.
    • srvstart

      private volatile boolean srvstart
      is thread started.
  • Constructor Details

    • ChannelFactory

      public ChannelFactory()
      Constructs a ChannelFactory on the DEFAULT_PORT.
    • ChannelFactory

      public ChannelFactory(int p)
      Constructs a ChannelFactory.
      Parameters:
      p - port.
  • Method Details