All Packages Class Hierarchy This Package Previous Next Index
Class SE.kth.speech.broker.Connection
SE.kth.speech.broker.Connection
- public abstract class Connection
The base class for both client-side and server-side classes for Broker
connections.
- See Also:
- BrokerClient, BrokerServerConnection
-
Connection()
-
-
broken()
- true if the connection is broken.
-
callProc(String, String)
-
Send a CALL PROC message.
-
close()
- Close the connection, cleanly if possible
The connection can not be used after this call.
-
getName()
- The name of the client.
-
getNameNonBlocking()
-
-
send(String)
- Send a string through the connection.
-
setDebug(boolean)
-
-
setName(String)
- Set the name of the connection.
-
toString()
-
Connection
public Connection()
setDebug
public void setDebug(boolean newDebug)
getName
public String getName()
- The name of the client.
For clients, this name is assigned at connect-time. Will block until a name
is set.
- Returns:
- The name of the client
getNameNonBlocking
public String getNameNonBlocking()
toString
public String toString()
setName
public void setName(String newName)
- Set the name of the connection.
This should Only be called by Broker classes.
It can only be called once - the name of a connection can not be changed.
- Parameters:
- newName - the name of the connection.
send
public void send(String s) throws ServerDownException
- Send a string through the connection.
This method synchronizes on the writer attribute. To do several sends in
a row with nothing coming in between, synchronize on writer, and then call
send() several times.
- Parameters:
- s - The string to send.
- Throws: ServerDownException
- The other end of the connection has closed.
- See Also:
- writer
callProc
public void callProc(String server,
String data) throws ServerDownException
- Send a CALL PROC message.
- Parameters:
- server - The server the CALL PROC is destined for.
- data - The parameters to the call
- Throws: ServerDownException
- The connection is down.
broken
public boolean broken()
- true if the connection is broken.
- Returns:
- true if the connection is broken, false otherwise.
close
public void close()
- Close the connection, cleanly if possible
The connection can not be used after this call.
All Packages Class Hierarchy This Package Previous Next Index