Package org.jrd.agent

Class ConnectionDelegator

  • All Implemented Interfaces:
    java.lang.Runnable

    public final class ConnectionDelegator
    extends java.lang.Thread
    • Nested Class Summary

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

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

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void gracefulShutdown()
      Closes server socket Already connected clients can finish their work but no new clients can connect.
      static boolean initialize​(java.lang.String hostname, java.lang.Integer port, InstrumentationProvider provider)
      This method is used to create an ConnectionDelegator object and start listener thread
      void run()
      Waits for new connection.
      private static void setRunning​(boolean isRunning)  
      • 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

      • ConnectionDelegator

        private ConnectionDelegator​(InstrumentationProvider provider,
                                    java.net.ServerSocket serverSocket)
    • Method Detail

      • initialize

        public static boolean initialize​(java.lang.String hostname,
                                         java.lang.Integer port,
                                         InstrumentationProvider provider)
        This method is used to create an ConnectionDelegator object and start listener thread
        Parameters:
        hostname - host name to open communication with
        port - on which open socket
        provider - this is where instrumentation and transformer objects are stored
        Returns:
        boolean true if ran correctly, else false
      • run

        public void run()
        Waits for new connection. When client connects starts new worker thread and delegates connection to it
        Specified by:
        run in interface java.lang.Runnable
        Overrides:
        run in class java.lang.Thread
      • setRunning

        private static void setRunning​(boolean isRunning)
      • gracefulShutdown

        public static void gracefulShutdown()
        Closes server socket Already connected clients can finish their work but no new clients can connect.