Package com.vmware.spbm.connection
Class KeepAlive
- java.lang.Object
-
- com.vmware.spbm.connection.KeepAlive
-
- All Implemented Interfaces:
java.lang.Runnable
public class KeepAlive extends java.lang.Object implements java.lang.RunnableThis 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.LongDEFAULT_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 millisecondsKeepAlive(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 booleanisRunning()voidkeepAlive()kicks off a thread that will call the "keep alive" method on the connection instancestatic java.lang.ThreadkeepAlive(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.ThreadkeepAlive(com.vmware.vim25.VimPortType vimPort, com.vmware.vim25.ManagedObjectReference serviceInstanceRef, java.lang.Long interval)constructs a new embedded thread to keep alivevoidrun()starts a keep-alive thread which will call keepAlive then sleep for the intervalstatic voidrun(com.vmware.vim25.VimPortType vimPort, com.vmware.vim25.ManagedObjectReference serviceInstanceRef)calls "currentTime" against the supplied objectsvoidstop()signals the embedded thread to stop
-
-
-
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.RuntimeFaultFaultMsgcalls "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:
runin interfacejava.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:
-
-