Package com.sun.rpc

Class Connection

  • All Implemented Interfaces:
    java.lang.Runnable
    Direct Known Subclasses:
    ConnectDatagram, ConnectSocket

    public abstract class Connection
    extends java.lang.Thread
    Sets up a connection to the server using either UDP or TCP as determined by the subclass. This class also handles the connection caching.
    Author:
    Brent Callaghan
    See Also:
    ConnectSocket, ConnectDatagram
    • 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
      int port  
      java.lang.String server  
      • Fields inherited from class java.lang.Thread

        MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
    • Constructor Summary

      Constructors 
      Constructor Description
      Connection​(java.lang.String server, int port, java.lang.String proto, int maxSize)
      Construct a new connection to a specified server and port using protocol proto with a reply buffer of size maxsize.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static Connection getCache​(java.lang.String server, int port, java.lang.String proto)
      Get a cached connection for the specified server, port and protocol
      static void putCache​(Connection conn)
      Stash a new connection in the cache
      void run()  
      java.lang.String toString()
      Return information about the connection
      • 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, yield
      • Methods inherited from class java.lang.Object

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

      • server

        public java.lang.String server
      • port

        public int port
    • Constructor Detail

      • Connection

        public Connection​(java.lang.String server,
                          int port,
                          java.lang.String proto,
                          int maxSize)
        Construct a new connection to a specified server and port using protocol proto with a reply buffer of size maxsize.
        Parameters:
        server - The hostname of the server
        port - The port number on the server
    • Method Detail

      • getCache

        public static Connection getCache​(java.lang.String server,
                                          int port,
                                          java.lang.String proto)
        Get a cached connection for the specified server, port and protocol
        Parameters:
        server - The hostname of the server
        port - The port number on the server
        proto - The connection type: "tcp" or "udp"
      • putCache

        public static void putCache​(Connection conn)
        Stash a new connection in the cache
        Parameters:
        The - connection to be cached
      • toString

        public java.lang.String toString()
        Return information about the connection
        Overrides:
        toString in class java.lang.Thread
      • run

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