Class CodeServer

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.lang.Runnable

    public class CodeServer
    extends java.net.ServerSocket
    implements java.lang.Runnable
    This class implements a Java resource or class server. The typical client of this code server is the ClifClassLoader. The requested resource or class is first looked for in jar files in CLIF's extension libraries directory. Then, current directory and directories set by property clif.codeserver.path are visited, in this order. The property, when set, should contain a ';' separated list of directory paths.

    In detail, the codeserver listens on a given port, and upon any connection request:

    • reads from the socket an UTF String representing the class or resource name
    • writes a positive int stating the resource or class file length or a negative int providing an error code (resource/class not found or resource/class too big).
    • if the class/resource file has been found and can be transfered, all of its bytes are written in the socket.
    • the socket is not closed by the code server, except when an exception occurs while handling the socket.
    As of current implementation, class/resource files bigger than 2GB can't be transfered.
    Author:
    Bruno Dillenseger
    See Also:
    ClifClassLoader
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void launch​(java.net.InetAddress localAddr, int port, java.lang.String extdir, java.lang.String path)  
      void run()  
      • Methods inherited from class java.net.ServerSocket

        accept, bind, bind, close, getChannel, getInetAddress, getLocalPort, getLocalSocketAddress, getOption, getReceiveBufferSize, getReuseAddress, getSoTimeout, implAccept, isBound, isClosed, setOption, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSocketFactory, setSoTimeout, supportedOptions, toString
      • Methods inherited from class java.lang.Object

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

      • launch

        public static void launch​(java.net.InetAddress localAddr,
                                  int port,
                                  java.lang.String extdir,
                                  java.lang.String path)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • run

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