public class RpcStreamConnection extends RpcConnection
The implementation here uses a small stack of input and output streams based on socket streams at the lowest level, with (at least) an optional connection compression stream on top of that layer, and with charset conversion where necessary.
Modifier and Type | Field and Description |
---|---|
protected static int |
INITIAL_SENDBUF_SIZE
Number of bytes we allocate for initial byte arrays for sending RPC
packets.
|
protected static int |
SENDBUF_REALLOC_INCR
When we run out of send buffer space in putPacket, we allocate another,
larger, buffer; this constant determines how much larger than the
existing buffer the new one should be, or, alternatively, how much bigger
than the incoming field length the new buffer should be.
|
static java.lang.String |
TRACE_PREFIX |
clientCharset, filesysUtf8bom, fingerprint, flowController, hostIp, hostName, hostPort, NON_UNICODE_SERVER_CHARSET, NON_UNICODE_SERVER_CHARSET_NAME, ourIp, ourPort, props, secure, stats, trusted, UNICODE_SERVER_CHARSET, UNICODE_SERVER_CHARSET_NAME, unicodeServer, UNKNOWN_SERVER_HOST, UNKNOWN_SERVER_PORT, usingCompression
Constructor and Description |
---|
RpcStreamConnection(java.lang.String serverHost,
int serverPort,
java.util.Properties props,
ServerStats stats,
java.nio.charset.Charset charset)
Construct a new Perforce RPC connection to the named Perforce server
using java.io socket streams at the lowest level.
|
RpcStreamConnection(java.lang.String serverHost,
int serverPort,
java.util.Properties props,
ServerStats stats,
java.nio.charset.Charset charset,
boolean secure)
Construct a new Perforce RPC connection to the named Perforce server
using java.io socket streams at the lowest level.
|
RpcStreamConnection(java.lang.String serverHost,
int serverPort,
java.util.Properties props,
ServerStats stats,
java.nio.charset.Charset charset,
RpcSocketPool pool)
Construct a new Perforce RPC connection to the named Perforce server
using java.io socket streams at the lowest level.
|
RpcStreamConnection(java.lang.String serverHost,
int serverPort,
java.util.Properties props,
ServerStats stats,
java.nio.charset.Charset charset,
RpcSocketPool pool,
boolean secure)
Construct a new Perforce RPC connection to the named Perforce server
using java.io socket streams at the lowest level.
|
RpcStreamConnection(java.lang.String serverHost,
int serverPort,
java.util.Properties props,
ServerStats stats,
java.nio.charset.Charset charset,
java.net.Socket socket)
Construct a new Perforce RPC connection to the named Perforce server
using java.io socket streams at the lowest level.
|
RpcStreamConnection(java.lang.String serverHost,
int serverPort,
java.util.Properties props,
ServerStats stats,
java.nio.charset.Charset charset,
java.net.Socket socket,
boolean secure)
Construct a new Perforce RPC connection to the named Perforce server
using java.io socket streams at the lowest level.
|
RpcStreamConnection(java.lang.String serverHost,
int serverPort,
java.util.Properties props,
ServerStats stats,
java.nio.charset.Charset charset,
java.net.Socket socket,
RpcSocketPool pool,
boolean secure)
Construct a new Perforce RPC connection to the named Perforce server
using java.io socket streams at the lowest level.
|
RpcStreamConnection(java.lang.String serverHost,
int serverPort,
java.util.Properties props,
ServerStats stats,
java.nio.charset.Charset charset,
java.net.Socket socket,
RpcSocketPool pool,
boolean secure,
java.lang.String rsh)
Construct a new Perforce RPC connection to the named Perforce server
using java.io socket streams at the lowest level.
|
Modifier and Type | Method and Description |
---|---|
void |
disconnect(RpcPacketDispatcher dispatcher)
Disconnect this server.
|
java.lang.String |
getClientIpPort()
Get the client's IP and port used for the RPC connection.
|
RpcPacket |
getRpcPacket()
Get a Perforce RPC packet from the underlying stream.
|
RpcPacket |
getRpcPacket(RpcPacketFieldRule fieldRule,
IFilterCallback filterCallback)
Get a Perforce RPC packet from the underlying stream with an optional
rule to handle the RPC packet fields.
|
java.lang.String |
getServerIpPort()
Get the server's IP and port used for the RPC connection.
|
int |
getSystemRecvBufferSize()
Return the system (i.e.
|
int |
getSystemSendBufferSize()
Return the system (i.e.
|
long |
putRpcPacket(RpcPacket packet)
Put a Perforce RPC packet onto the output stream.
|
long |
putRpcPackets(RpcPacket[] packets)
Put an array of RPC packets.
|
void |
useConnectionCompression()
If called, will set this connection to use (GZIP) compression for all
traffic on this connection from this point on.
|
clientConfirm, getClientCharset, getFilesysUtf8bom, getFingerprint, getFlowController, getHostIp, getHostName, getHostPort, getNormalizedBytes, getNormalizedString, getProps, getStats, isSecure, isTrusted, isUnicodeServer, isUsingCompression, marshalPacketField, marshalPacketValue, setClientCharset, setFingerprint, setFlowController, setHostIp, setHostName, setHostPort, setProps, setSecure, setStats, setTrusted, setUnicodeServer, setUsingCompression
public static final java.lang.String TRACE_PREFIX
protected static final int INITIAL_SENDBUF_SIZE
protected static final int SENDBUF_REALLOC_INCR
public RpcStreamConnection(java.lang.String serverHost, int serverPort, java.util.Properties props, ServerStats stats, java.nio.charset.Charset charset) throws ConnectionException
ConnectionException
public RpcStreamConnection(java.lang.String serverHost, int serverPort, java.util.Properties props, ServerStats stats, java.nio.charset.Charset charset, boolean secure) throws ConnectionException
ConnectionException
public RpcStreamConnection(java.lang.String serverHost, int serverPort, java.util.Properties props, ServerStats stats, java.nio.charset.Charset charset, java.net.Socket socket) throws ConnectionException
ConnectionException
public RpcStreamConnection(java.lang.String serverHost, int serverPort, java.util.Properties props, ServerStats stats, java.nio.charset.Charset charset, RpcSocketPool pool) throws ConnectionException
ConnectionException
public RpcStreamConnection(java.lang.String serverHost, int serverPort, java.util.Properties props, ServerStats stats, java.nio.charset.Charset charset, java.net.Socket socket, boolean secure) throws ConnectionException
ConnectionException
public RpcStreamConnection(java.lang.String serverHost, int serverPort, java.util.Properties props, ServerStats stats, java.nio.charset.Charset charset, RpcSocketPool pool, boolean secure) throws ConnectionException
ConnectionException
public RpcStreamConnection(java.lang.String serverHost, int serverPort, java.util.Properties props, ServerStats stats, java.nio.charset.Charset charset, java.net.Socket socket, RpcSocketPool pool, boolean secure) throws ConnectionException
ConnectionException
public RpcStreamConnection(java.lang.String serverHost, int serverPort, java.util.Properties props, ServerStats stats, java.nio.charset.Charset charset, java.net.Socket socket, RpcSocketPool pool, boolean secure, java.lang.String rsh) throws ConnectionException
ConnectionException
public java.lang.String getServerIpPort()
RpcConnection
getServerIpPort
in class RpcConnection
public java.lang.String getClientIpPort()
RpcConnection
getClientIpPort
in class RpcConnection
RpcConnection.getClientIpPort()
public void disconnect(RpcPacketDispatcher dispatcher) throws ConnectionException
RpcConnection
disconnect
in class RpcConnection
ConnectionException
public RpcPacket getRpcPacket() throws ConnectionException
getRpcPacket
in class RpcConnection
ConnectionException
public RpcPacket getRpcPacket(RpcPacketFieldRule fieldRule, IFilterCallback filterCallback) throws ConnectionException
getRpcPacket
in class RpcConnection
ConnectionException
public int getSystemRecvBufferSize()
RpcConnection
getSystemRecvBufferSize
in class RpcConnection
public int getSystemSendBufferSize()
RpcConnection
getSystemSendBufferSize
in class RpcConnection
public long putRpcPackets(@Nonnull RpcPacket[] packets) throws ConnectionException
RpcConnection
putRpcPackets
in class RpcConnection
ConnectionException
public long putRpcPacket(@Nonnull RpcPacket packet) throws ConnectionException
Note that in general, we don't know how large the packet's output byte buffer is going to have to be until we've finished the packet contents marshaling, so we implement buffer resizing when needed. Our initial guess isINITIAL_SENDBUF_SIZE
bytes; we grow the buffer by increasing itSENDBUF_REALLOC_INCR
times each buffer increase.
putRpcPacket
in class RpcConnection
ConnectionException
public void useConnectionCompression() throws ConnectionException
RpcConnection
useConnectionCompression
in class RpcConnection
ConnectionException
Copyright © 2018 Perforce Software. All Rights Reserved.