Package org.apache.derby.client.net
Class NetAgent
- java.lang.Object
-
- org.apache.derby.client.am.Agent
-
- org.apache.derby.client.net.NetAgent
-
public class NetAgent extends Agent
-
-
Field Summary
-
Fields inherited from class org.apache.derby.client.am.Agent
logWriter_
-
-
Constructor Summary
Constructors Constructor Description NetAgent(NetConnection netConnection, LogWriter logWriter)
NetAgent(NetConnection netConnection, LogWriter netLogWriter, int loginTimeout, java.lang.String server, int port, int clientSSLMode)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
beginReadChain(ClientStatement statement)
protected void
beginReadChainOutsideUOW()
void
beginWriteChain(ClientStatement statement)
void
beginWriteChainOutsideUOW()
void
checkForChainBreakingException_()
(package private) void
clearSvrcod()
void
close_()
protected void
endWriteChain()
void
flush_()
CcsidManager
getCurrentCcsidManager()
java.io.InputStream
getInputStream()
java.io.OutputStream
getOutputStream()
private int
getSvrcod()
protected int
getTimeout()
Returns the current timeout value that is set on the socket.protected void
markChainBreakingException_()
(package private) void
markWriteChainAsDirty()
Marks the agent's write chain as dirty.private void
readDeferredResetConnection()
protected void
resetAgent_(LogWriter netLogWriter, int loginTimeout, java.lang.String server, int port)
private void
sendRequest()
(package private) void
setInputStream(java.io.InputStream inputStream)
(package private) void
setOutputStream(java.io.OutputStream outputStream)
(package private) void
setSvrcod(int svrcod)
protected void
setTimeout(int timeout)
Specifies the maximum blocking time that should be used when sending and receiving messages.(package private) void
switchToEbcdicMgr()
Switches the current CCSID manager to EBCDIC(package private) void
switchToUtf8CcsidMgr()
Switches the current CCSID manager to UTF-8(package private) void
throwCommunicationsFailure(java.lang.Throwable cause)
private void
verifyWriteChainIsClean()
private void
writeDeferredResetConnection()
-
Methods inherited from class org.apache.derby.client.am.Agent
accumulateChainBreakingReadExceptionAndThrow, accumulateReadException, checkForExceptions, close, endReadChain, flow, flowOutsideUOW, getLogWriter, loggingEnabled, setBatchedExceptionLabelIndex, setLogWriter
-
-
-
-
Field Detail
-
connectionRequest_
ConnectionRequestInterface connectionRequest_
-
statementRequest_
StatementRequestInterface statementRequest_
-
resultSetRequest_
ResultSetRequestInterface resultSetRequest_
-
connectionReply_
ConnectionReply connectionReply_
-
packageReply_
private ConnectionReply packageReply_
-
statementReply_
StatementReply statementReply_
-
resultSetReply_
ResultSetReply resultSetReply_
-
netConnection_
NetConnection netConnection_
-
request_
private Request request_
-
netConnectionRequest_
NetConnectionRequest netConnectionRequest_
-
netPackageRequest_
private NetPackageRequest netPackageRequest_
-
netStatementRequest_
private NetStatementRequest netStatementRequest_
-
netResultSetRequest_
private NetResultSetRequest netResultSetRequest_
-
reply_
private Reply reply_
-
netConnectionReply_
NetConnectionReply netConnectionReply_
-
netPackageReply_
private NetPackageReply netPackageReply_
-
netStatementReply_
private NetStatementReply netStatementReply_
-
netResultSetReply_
private NetResultSetReply netResultSetReply_
-
socket_
java.net.Socket socket_
-
rawSocketInputStream_
private java.io.InputStream rawSocketInputStream_
-
rawSocketOutputStream_
private java.io.OutputStream rawSocketOutputStream_
-
server_
java.lang.String server_
-
port_
int port_
-
clientSSLMode_
private int clientSSLMode_
-
ebcdicCcsidManager_
private EbcdicCcsidManager ebcdicCcsidManager_
-
utf8CcsidManager_
private Utf8CcsidManager utf8CcsidManager_
-
currentCcsidManager_
private CcsidManager currentCcsidManager_
-
typdef_
Typdef typdef_
-
targetTypdef_
Typdef targetTypdef_
-
originalTargetTypdef_
Typdef originalTargetTypdef_
-
svrcod_
private int svrcod_
-
orignalTargetSqlam_
int orignalTargetSqlam_
-
targetSqlam_
int targetSqlam_
-
exceptionOpeningSocket_
SqlException exceptionOpeningSocket_
-
exceptionConvertingRdbnam
SqlException exceptionConvertingRdbnam
-
writeChainIsDirty_
private boolean writeChainIsDirty_
Flag which indicates that a writeChain has been started and data sent to the server. If true, starting a new write chain will throw a DisconnectException. It is cleared when the write chain is ended.
-
-
Constructor Detail
-
NetAgent
public NetAgent(NetConnection netConnection, LogWriter logWriter) throws SqlException
- Throws:
SqlException
-
NetAgent
NetAgent(NetConnection netConnection, LogWriter netLogWriter, int loginTimeout, java.lang.String server, int port, int clientSSLMode) throws SqlException
- Throws:
SqlException
-
-
Method Detail
-
resetAgent_
protected void resetAgent_(LogWriter netLogWriter, int loginTimeout, java.lang.String server, int port) throws SqlException
- Specified by:
resetAgent_
in classAgent
- Throws:
SqlException
-
setSvrcod
void setSvrcod(int svrcod)
-
clearSvrcod
void clearSvrcod()
-
getSvrcod
private int getSvrcod()
-
flush_
public void flush_() throws DisconnectException
- Specified by:
flush_
in classAgent
- Throws:
DisconnectException
-
close_
public void close_() throws SqlException
- Specified by:
close_
in classAgent
- Throws:
SqlException
-
setTimeout
protected void setTimeout(int timeout)
Specifies the maximum blocking time that should be used when sending and receiving messages. The timeout is implemented by using the the underlying socket implementation's timeout support. Note that the support for timeout on sockets is dependent on the OS implementation. For the same reason we ignore any exceptions thrown by the call to the socket layer.- Parameters:
timeout
- The timeout value in seconds. A value of 0 corresponds to infinite timeout.
-
getTimeout
protected int getTimeout()
Returns the current timeout value that is set on the socket. Note that the support for timeout on sockets is dependent on the OS implementation. For the same reason we ignore any exceptions thrown by the call to the socket layer.- Returns:
- The timeout value in seconds. A value of 0 corresponds to that no timeout is specified on the socket.
-
sendRequest
private void sendRequest() throws DisconnectException
- Throws:
DisconnectException
-
getInputStream
public java.io.InputStream getInputStream()
-
getCurrentCcsidManager
public CcsidManager getCurrentCcsidManager()
-
getOutputStream
public java.io.OutputStream getOutputStream()
-
setInputStream
void setInputStream(java.io.InputStream inputStream)
-
setOutputStream
void setOutputStream(java.io.OutputStream outputStream)
-
throwCommunicationsFailure
void throwCommunicationsFailure(java.lang.Throwable cause) throws DisconnectException
- Throws:
DisconnectException
-
markChainBreakingException_
protected void markChainBreakingException_()
- Specified by:
markChainBreakingException_
in classAgent
-
checkForChainBreakingException_
public void checkForChainBreakingException_() throws SqlException
- Specified by:
checkForChainBreakingException_
in classAgent
- Throws:
SqlException
-
writeDeferredResetConnection
private void writeDeferredResetConnection() throws SqlException
- Throws:
SqlException
-
markWriteChainAsDirty
void markWriteChainAsDirty()
Marks the agent's write chain as dirty. A write chain is dirty when data from it has been sent to the server. A dirty write chain cannot be reset and reused for another request until the remaining data has been sent to the server and the write chain properly ended. Resetting a dirty chain will cause the new request to be appended to the unfinished request already at the server, which will likely lead to cryptic syntax errors.
-
verifyWriteChainIsClean
private void verifyWriteChainIsClean() throws DisconnectException
- Throws:
DisconnectException
-
beginWriteChainOutsideUOW
public void beginWriteChainOutsideUOW() throws SqlException
- Specified by:
beginWriteChainOutsideUOW
in classAgent
- Throws:
SqlException
-
beginWriteChain
public void beginWriteChain(ClientStatement statement) throws SqlException
- Overrides:
beginWriteChain
in classAgent
- Throws:
SqlException
-
endWriteChain
protected void endWriteChain()
- Specified by:
endWriteChain
in classAgent
-
readDeferredResetConnection
private void readDeferredResetConnection() throws SqlException
- Throws:
SqlException
-
beginReadChain
protected void beginReadChain(ClientStatement statement) throws SqlException
- Overrides:
beginReadChain
in classAgent
- Throws:
SqlException
-
beginReadChainOutsideUOW
protected void beginReadChainOutsideUOW() throws SqlException
- Overrides:
beginReadChainOutsideUOW
in classAgent
- Throws:
SqlException
-
switchToUtf8CcsidMgr
void switchToUtf8CcsidMgr()
Switches the current CCSID manager to UTF-8
-
switchToEbcdicMgr
void switchToEbcdicMgr()
Switches the current CCSID manager to EBCDIC
-
-