Class KeepAlive

  • All Implemented Interfaces:
    java.lang.Runnable

    public class KeepAlive
    extends java.lang.Object
    implements java.lang.Runnable
    This is a keep-alive utility class. It will keep an instance of a connection alive by polling the "currentTime" method on the remote Host or vCenter that the supplied connection and VimPortType were talking to.
    See Also:
    VimPortType
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.Long DEFAULT_INTERVAL  
    • Constructor Summary

      Constructors 
      Constructor Description
      KeepAlive​(com.vmware.vim25.VimPortType vimPort, com.vmware.vim25.ManagedObjectReference serviceInstanceReference)
      this class is immutable and acts on the supplied vimPort and serviceInstanceReference the default interval is set to 300000 milliseconds
      KeepAlive​(com.vmware.vim25.VimPortType vimPort, com.vmware.vim25.ManagedObjectReference serviceInstanceReference, java.lang.Long interval)
      builds an instance of this object
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isRunning()  
      void keepAlive()
      kicks off a thread that will call the "keep alive" method on the connection instance
      static java.lang.Thread keepAlive​(com.vmware.vim25.VimPortType vimPort, com.vmware.vim25.ManagedObjectReference serviceInstanceRef)
      Returns a thread you can start to run a keep alive on your connection.
      static java.lang.Thread keepAlive​(com.vmware.vim25.VimPortType vimPort, com.vmware.vim25.ManagedObjectReference serviceInstanceRef, java.lang.Long interval)
      constructs a new embedded thread to keep alive
      void run()
      starts a keep-alive thread which will call keepAlive then sleep for the interval
      static void run​(com.vmware.vim25.VimPortType vimPort, com.vmware.vim25.ManagedObjectReference serviceInstanceRef)
      calls "currentTime" against the supplied objects
      void stop()
      signals the embedded thread to stop
      • Methods inherited from class java.lang.Object

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

      • DEFAULT_INTERVAL

        public static final java.lang.Long DEFAULT_INTERVAL
    • Constructor Detail

      • KeepAlive

        public KeepAlive​(com.vmware.vim25.VimPortType vimPort,
                         com.vmware.vim25.ManagedObjectReference serviceInstanceReference)
        this class is immutable and acts on the supplied vimPort and serviceInstanceReference the default interval is set to 300000 milliseconds
        Parameters:
        vimPort -
        serviceInstanceReference -
      • KeepAlive

        public KeepAlive​(com.vmware.vim25.VimPortType vimPort,
                         com.vmware.vim25.ManagedObjectReference serviceInstanceReference,
                         java.lang.Long interval)
        builds an instance of this object
        Parameters:
        vimPort -
        serviceInstanceReference -
        interval -
    • Method Detail

      • keepAlive

        public void keepAlive()
        kicks off a thread that will call the "keep alive" method on the connection instance
      • run

        public static void run​(com.vmware.vim25.VimPortType vimPort,
                               com.vmware.vim25.ManagedObjectReference serviceInstanceRef)
                        throws com.vmware.vim25.RuntimeFaultFaultMsg
        calls "currentTime" against the supplied objects
        Parameters:
        vimPort -
        serviceInstanceRef -
        Throws:
        com.vmware.vim25.RuntimeFaultFaultMsg
      • isRunning

        public boolean isRunning()
        Returns:
        true if the embedded thread is running
      • stop

        public void stop()
        signals the embedded thread to stop
      • run

        public void run()
        starts a keep-alive thread which will call keepAlive then sleep for the interval
        Specified by:
        run in interface java.lang.Runnable
      • keepAlive

        public static java.lang.Thread keepAlive​(com.vmware.vim25.VimPortType vimPort,
                                                 com.vmware.vim25.ManagedObjectReference serviceInstanceRef)
        Returns a thread you can start to run a keep alive on your connection. You supply it with your copy of the vimPort and serviceInstanceRef to ping. Call start on the thread when you need to start the keep-alive.
        Parameters:
        vimPort -
        serviceInstanceRef -
        Returns:
      • keepAlive

        public static java.lang.Thread keepAlive​(com.vmware.vim25.VimPortType vimPort,
                                                 com.vmware.vim25.ManagedObjectReference serviceInstanceRef,
                                                 java.lang.Long interval)
        constructs a new embedded thread to keep alive
        Parameters:
        vimPort -
        serviceInstanceRef -
        interval -
        Returns: