public class PooledSocket
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
void |
acquired()
Records acquisition information.
|
void |
auth()
Authenticates with the server by sending the session ID.
|
void |
bye()
Terminates the server connection gracefully by sending a termination command and closing the socket.
|
void |
checkFreeSocket()
Checks the connection to the server by sending a ping command.
|
void |
close()
Closes the PooledSocket.
|
void |
closeLater()
Marks the PooledSocket for closing.
|
void |
closeNT()
Closes the PooledSocket, ignoring any I/O exceptions that may occur.
|
java.lang.RuntimeException |
getAcquiredAt() |
java.lang.Thread |
getAcquiredFrom()
Returns the Thread from which this PooledSocket was acquired, if it has not yet been garbage collected.
|
long |
getAcquiredWhen() |
java.lang.RuntimeException |
getCreatedAt() |
long |
getCreatedWhen() |
CryptoHandlerI |
getCryptoHandler()
Retrieves a CryptoHandlerI from the BackendProtocolServer.
|
long |
getLastUsed() |
java.lang.String |
getLogPrefix() |
int |
getPid() |
SocketPool |
getSocketPool() |
TransportI |
getTransport()
Returns the underlying TransportI used by this PooledSocket.
|
boolean |
isAuthenticated()
Comparator for PooledSockets.
|
boolean |
isClosed()
Checks if the PooledSocket is closed.
|
int |
ping()
Sends a ping command to the server to check the connection and retrieve the server's
protocol version.
|
void |
readMagic()
Tries to read the protocol magic from the input stream.
|
void |
readMagic(boolean updateLastUsed) |
void |
released()
Resets acquisition information.
|
void |
reset()
Resets the transport.
|
void |
rinse()
Returns this PooledSocket to the pool.
|
void |
setAcquiredAt(java.lang.RuntimeException $15) |
void |
setAcquiredWhen(long $16) |
void |
setAuthenticated(boolean $13) |
void |
setCreatedAt(java.lang.RuntimeException $18) |
void |
setCreatedWhen(long $17) |
void |
setLastUsed(long $14) |
void |
setLogPrefix(java.lang.String $21) |
void |
setPid(int $19) |
void |
setSocketPool(SocketPool $20) |
boolean |
shouldBeClosed()
Checks if the PooledSocket should be closed.
|
java.lang.String |
toString() |
long |
validUntil()
Returns the timestamp until which this PooledSocket is considered valid.
|
boolean |
wasRecentlyUsed()
Checks if this PooledSocket was recently used.
|
public TransportI getTransport()
public java.lang.Thread getAcquiredFrom()
public void acquired()
public void released()
acquired() method.public void rinse()
public boolean wasRecentlyUsed()
RECENT_THRESHOLD.true if the socket has been used within the recent threshold, false otherwise.public long validUntil()
RECENT_THRESHOLD.public CryptoHandlerI getCryptoHandler() throws ServerConnectionException
ServerConnectionException - If a server connection error occurs or if an unexpected
response is received from the server.SocketPool,
BackendProtocolServerpublic void auth()
throws ServerConnectionException
This method reads a protocol magic value after receiving the server's response to ensure synchronization with the server's communication protocol.
ServerConnectionException - If authentication fails, a connection timeout occurs,
or if an unexpected response is received from the server.SocketPool,
BackendProtocolServerpublic int ping()
throws ServerConnectionException
ServerConnectionException - If a server connection error occurs.SocketPool,
BackendConnection,
BackendProtocolServerpublic void checkFreeSocket()
throws ServerConnectionException
ServerConnectionException - If a server connection error occurs.public void bye()
SocketPoolpublic void close()
throws java.io.IOException
IOException - If an I/O error occurs during closing.SocketPoolpublic void closeNT()
SocketPoolpublic void closeLater()
SocketPool.recycleOldSocket(PooledSocket) method. This is used to avoid closing sockets
within critical code sections.SocketPool,
BackendQueryResultspublic boolean shouldBeClosed()
SocketPool.recycleOldSocket(PooledSocket) method to identify sockets that need to be closed.true if the socket should be closed, false otherwise.SocketPoolpublic boolean isClosed()
true if the socket is closed, false otherwise.public void reset()
throws java.io.IOException
SocketPool.recycleOldSocket(PooledSocket)
method to allow the transport to be reused.IOException - If an I/O error occurs.public void readMagic()
throws java.io.IOException
updateLastUsed - Whether to update the last-used timestamp after reading the magic.IOException - If an I/O error occurs or if the incorrect protocol magic is received.ServerConnectionException - If a timeout occurs while reading the magic.SocketPool,
BackendConnection,
BackendProtocolServerpublic void readMagic(boolean updateLastUsed)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean isAuthenticated()
SocketPool's PriorityQueue. Sockets are prioritized based on their creation time.SocketPoolpublic void setAuthenticated(boolean $13)
public long getLastUsed()
public void setLastUsed(long $14)
public java.lang.RuntimeException getAcquiredAt()
public void setAcquiredAt(java.lang.RuntimeException $15)
public long getAcquiredWhen()
public void setAcquiredWhen(long $16)
public long getCreatedWhen()
public void setCreatedWhen(long $17)
public java.lang.RuntimeException getCreatedAt()
public void setCreatedAt(java.lang.RuntimeException $18)
public int getPid()
public void setPid(int $19)
public SocketPool getSocketPool()
public void setSocketPool(SocketPool $20)
public java.lang.String getLogPrefix()
public void setLogPrefix(java.lang.String $21)
Copyright © 2000-2025 OAshi S.à r.l. All Rights Reserved.