public class FlowControl
extends java.lang.Object
In general, we keep a count of outstanding bytes and send a flush1 when it gets above the high water mark (hwm); we then wait for a corresponding flush2 before doing much else. The server does the same thing in reverse. This will all be explained in more detail later when the full implementation is much clearer... (HR).
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_HI_MARK
Default maximum number of bytes allowed to be outstanding before we start
worrying that we haven't seen a suitable flush2 response.
|
static int |
DEFAULT_LO_MARK
Default maximum number of bytes allowed to be outstanding before we send
a flush1 message on duplex commands.
|
static int |
FLUSH_CMD_LENGTH
Length in bytes of a flush command when marshaled.
|
static java.lang.String |
TRACE_PREFIX |
Constructor and Description |
---|
FlowControl(RpcPacketDispatcher mainDispatcher,
java.util.Properties props) |
Modifier and Type | Method and Description |
---|---|
void |
decrementCurrentHiMark(int decr) |
long |
getCurrentHiMark() |
long |
getCurrentLoMark() |
long |
getHiMark() |
long |
getLoMark() |
void |
incrementCurrentHiMark(int incr) |
void |
processFlushCommandFromServer(RpcConnection rpcConnection,
RpcFunctionSpec funcSpec,
java.util.Map<java.lang.String,java.lang.Object> resultsMap)
Given a map passed-in from the main dispatcher that represents
a flush command received from the Perforce server, respond
appropriately.
|
void |
sendFlush1(RpcConnection rpcConnection,
java.util.Map<java.lang.String,java.lang.Object> resultsMap) |
void |
sendFlush2(RpcConnection rpcConnection,
java.util.Map<java.lang.String,java.lang.Object> resultsMap) |
void |
setCurrentHiMark(long currentHiMark) |
void |
setCurrentLoMark(long currentLoMark) |
void |
setHiMark(long hiMark) |
void |
setLoMark(long loMark) |
public static final java.lang.String TRACE_PREFIX
public static final int FLUSH_CMD_LENGTH
public static final int DEFAULT_LO_MARK
public static final long DEFAULT_HI_MARK
public FlowControl(RpcPacketDispatcher mainDispatcher, java.util.Properties props)
public void processFlushCommandFromServer(RpcConnection rpcConnection, RpcFunctionSpec funcSpec, java.util.Map<java.lang.String,java.lang.Object> resultsMap) throws ConnectionException
rpcConnection
- connectionfuncSpec
- specresultsMap
- mapConnectionException
- on errorpublic void sendFlush1(RpcConnection rpcConnection, java.util.Map<java.lang.String,java.lang.Object> resultsMap)
public void sendFlush2(RpcConnection rpcConnection, java.util.Map<java.lang.String,java.lang.Object> resultsMap) throws ConnectionException
ConnectionException
public void incrementCurrentHiMark(int incr)
public void decrementCurrentHiMark(int decr)
public long getLoMark()
public void setLoMark(long loMark)
public long getHiMark()
public void setHiMark(long hiMark)
public long getCurrentLoMark()
public void setCurrentLoMark(long currentLoMark)
public long getCurrentHiMark()
public void setCurrentHiMark(long currentHiMark)