public abstract class AbstractConnection
extends java.lang.Thread
This abstract class provides the necessary methods to maintain the actual connection and encode the messages and headers in the proper format according to the Erlang distribution protocol. Subclasses can use these methods to provide a more or less transparent communication channel as desired.
Note that no receive methods are provided. Subclasses must provide methods for message delivery, and may implement their own receive methods.
If an exception occurs in any of the methods in this class, the connection will be closed and must be reopened in order to resume communication with the peer. This will be indicated to the subclass by passing the exception to its delivery() method.
The System property OtpConnection.trace can be used to change the initial
trace level setting for all connections. Normally the initial trace level is
0 and connections are not traced unless setTraceLevel()
is used to change the setting for a particular connection.
OtpConnection.trace can be used to turn on tracing by default for all
connections.
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the connection to the remote node.
|
abstract void |
deliver(java.lang.Exception e)
Deliver communication exceptions to the recipient.
|
abstract void |
deliver(OtpMsg msg)
Deliver messages to the recipient.
|
int |
getFlags() |
int |
getTraceLevel()
Get the trace level for this connection.
|
boolean |
isConnected()
Determine if the connection is still alive.
|
void |
run() |
void |
setFlags(int flags) |
int |
setTraceLevel(int level)
Set the trace level for this connection.
|
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
public void close()
public abstract void deliver(java.lang.Exception e)
public abstract void deliver(OtpMsg msg)
public int getFlags()
public int getTraceLevel()
public boolean isConnected()
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void setFlags(int flags)
public int setTraceLevel(int level)
Set the trace level for this connection. Normally tracing is off by default unless System property OtpConnection.trace was set.
The following levels are valid: 0 turns off tracing completely, 1 shows ordinary send and receive messages, 2 shows control messages such as link and unlink, 3 shows handshaking at connection setup, and 4 shows communication with Epmd. Each level includes the information shown by the lower ones.
level
- the level to set.