|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
com.altair.hwm.comm.HWMClientComm
public class HWMClientComm
Title: HWMClientComm
Description: The thread class that controls all communication to/from the slave application
Company: Altair Engineering class
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
HWMClientComm(HWMCommMgr hwmCommMgr,
java.lang.String szSessionName,
int nPort)
Purpose: Constructor. |
|
HWMClientComm(HWMCommMgr hwmCommMgr,
java.lang.String szSessionName,
int nPort,
java.lang.String strAddress)
Purpose: Constructor. |
|
HWMClientComm(HWMCommMgr hwmCommMgr,
java.lang.String szApp,
java.lang.String[] arrszArgs,
java.lang.String szWorkingDir,
java.lang.String szSessionName)
Purpose: Constructor. |
|
HWMClientComm(HWMCommMgr hwmCommMgr,
java.lang.String szApp,
java.lang.String[] arrszArgs,
java.lang.String szWorkingDir,
java.lang.String szSessionName,
int nPort)
Purpose: Constructor. |
Method Summary | |
---|---|
void |
AddCommListener(HWMCommListener hwmCommListener)
Add a CommListener to the listener list. |
void |
Connect(java.lang.String strAddress,
int nPort)
Establishes connection with the server |
void |
ConnectToApplication()
Purpose: Start a new application specified by the user. |
int |
CreateServerSocket()
Create a server socket so that client applications can connect |
void |
Disconnect()
Purpose: Exits the application. |
java.lang.String |
GetSessionName()
Purpose: Returns the session name associated with the HWMClientComm. |
boolean |
IsActive()
Purpose: Returns whether or not the HWMClientComm is Active, which means that it has a client application that has identified itself. |
boolean |
IsPeerAlive()
Check if the peer is alive |
boolean |
IsTerminated()
Purpose: Returns whether or not the HWMClientComm has terminated |
void |
RemoveCommListener(HWMCommListener hwmCommListener)
Remove a CommListener from the listener list. |
void |
run()
Purpose: Initiates the thread. |
void |
SendCommand(java.lang.String strMsg)
Purpose: Sends a command to the client application, adding the command to the m_vectPendingCommand vector. |
HWMResponseHandle |
SendMessage(java.lang.String strMsg)
Purpose: Very similar to SendQuery, but also throws an exception if not successful |
HWMResponseHandle |
SendQuery(java.lang.String strMsg)
Purpose: Sends a single SYNCHRONOUS query to the slave. |
void |
StartApplication()
Purpose: Start a new application specified by the user. |
void |
Terminate()
Purpose: Terminate the thread, after the next iteration of the main loop |
void |
WaitForHandShake()
After the server socket has been created, wait for the slave application to connect to the server socket and hand-shake with us |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public HWMClientComm(HWMCommMgr hwmCommMgr, java.lang.String szApp, java.lang.String[] arrszArgs, java.lang.String szWorkingDir, java.lang.String szSessionName, int nPort)
hwmCommMgr
- -- The reference to the manager that manages this
threadString
- szApp -- The application that the client comm thread
will be associated withString[]
- arrszArgs -- Any arguments that need to be passed to the
application, BEYOND those needed for the communicationsString
- szWorkingDir -- The directory that the application should
be started fromint
- nPort -- The port that should be used for the ServerSocketString
- szSessionName -- The Session Name that should be usedpublic HWMClientComm(HWMCommMgr hwmCommMgr, java.lang.String szApp, java.lang.String[] arrszArgs, java.lang.String szWorkingDir, java.lang.String szSessionName)
hwmCommMgr
- -- The reference to the manager that manages this
threadString
- szApp -- The application that the client comm thread will
be associated withString[]
- arrszArgs -- Any arguments that need to be passed to the
application, BEYOND those needed for the communicationsString
- szWorkingDir -- The directory that the application should
be started fromString
- szSessionName -- The Session Name that should be usedpublic HWMClientComm(HWMCommMgr hwmCommMgr, java.lang.String szSessionName, int nPort, java.lang.String strAddress)
hwmCommMgr
- -- The reference to the manager that manages this
threadString
- szSessionName -- The Session Name that should be usednPort
- The port number that the server application is listening tostrAddress
- The IP of the server app is listening atpublic HWMClientComm(HWMCommMgr hwmCommMgr, java.lang.String szSessionName, int nPort)
hwmCommMgr
- -- The reference to the manager that manages this
threadString
- szSessionName -- The Session Name that should be usednPort
- The port number that the server application is listening toMethod Detail |
---|
public void Terminate()
public java.lang.String GetSessionName()
public boolean IsActive()
public boolean IsTerminated()
public boolean IsPeerAlive()
public void Disconnect()
Disconnect
in interface HWMComm
public void Connect(java.lang.String strAddress, int nPort) throws java.lang.Exception
Connect
in interface HWMComm
strAddress
- The address of the servernPort
- The port number to which to connect to
IOException,
- UnknownHostException
java.lang.Exception
public int CreateServerSocket() throws java.io.IOException
java.lang.Exception
java.io.IOException
public void StartApplication()
public void WaitForHandShake() throws java.io.IOException
java.io.IOException
public void ConnectToApplication() throws java.lang.Exception
java.lang.Exception
- If any error occurspublic void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void SendCommand(java.lang.String strMsg)
String
- strMsg The unformatted message, exactly as it should be
seen by the slave application.public HWMResponseHandle SendQuery(java.lang.String strMsg)
String
- strMsg The unformatted message, exactly as it should be
seen by the slave application.public HWMResponseHandle SendMessage(java.lang.String strMsg) throws java.lang.Exception
String
- strMsg The unformatted message, exactly as it should be
seen by the slave application.
java.lang.Exception
public void AddCommListener(HWMCommListener hwmCommListener)
hwmCommListener
- - The HWMCommListener to be addedpublic void RemoveCommListener(HWMCommListener hwmCommListener)
hwmCommListener
- - The HWMCommListener to be removed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |