|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.cuny.cat.server.ClientBehaviorController
public class ClientBehaviorController
allows the game server to take actions after a client does something a certain number of times, which may cause the game server unstable. Currently, two behaviors are monitored, reconnection and transaction request made outside rounds.
Parameters
| base.reconnection int (5 by default) |
(the maximal number of times a client may reconnect to the game server after dropping out) |
| base.request_at_wrong_time int (10 by default) |
(the number of requests made by a client at a wrong time that would lead to a daily ban.) |
Default Base
| behavior |
| Field Summary | |
|---|---|
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,edu.cuny.cat.server.ClientBehaviorController.Counter>> |
behaviorRecords
|
static java.lang.String |
CONNECTION_BANNING_PENALTY
|
static java.lang.String |
DAY_BANNING_PENALTY
penalty types |
static int |
DEFAULT_MAX_NUMBER_OF_RECONNECTION
default times of bad behaviors to incur a penalty |
static int |
DEFAULT_MAX_NUMBER_OF_REQUEST_AT_WRONG_TIME
|
protected int |
maxReconnection
|
protected int |
maxWrongRequest
|
static java.lang.String |
OTHER_PENALTY
|
static java.lang.String |
P_DEF_BASE
|
static java.lang.String |
P_RECONNECTION
parameters |
static java.lang.String |
P_REQUEST_AT_WRONG_TIME
|
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,edu.cuny.cat.server.ClientBehaviorController.Counter>> |
penaltyRecords
|
static java.lang.String |
RECONNECTION
problem-causing behavior types |
static java.lang.String |
REQUEST_AT_WRONG_TIME
|
| Constructor Summary | |
|---|---|
ClientBehaviorController()
|
|
| Method Summary | |
|---|---|
void |
addPenalty(java.lang.String clientId,
java.lang.String penaltyType)
add one unit of the specified penalty. |
int |
getPenalty(java.lang.String clientId,
java.lang.String penaltyType)
|
java.lang.String |
getPenaltyType(java.lang.String behaviorType)
|
void |
observe(java.lang.String clientId,
java.lang.String behaviorType)
updates records after a bad behavior is observed. |
void |
penaltyExecuted(java.lang.String clientId,
java.lang.String penaltyType)
fulfills the specified penalty one on a game client. |
void |
reset()
|
void |
setup(edu.cuny.config.param.ParameterDatabase parameters,
edu.cuny.config.param.Parameter base)
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String RECONNECTION
public static final java.lang.String REQUEST_AT_WRONG_TIME
public static final java.lang.String DAY_BANNING_PENALTY
public static final java.lang.String CONNECTION_BANNING_PENALTY
public static final java.lang.String OTHER_PENALTY
public static final java.lang.String P_RECONNECTION
public static final java.lang.String P_REQUEST_AT_WRONG_TIME
public static final java.lang.String P_DEF_BASE
public static final int DEFAULT_MAX_NUMBER_OF_RECONNECTION
public static final int DEFAULT_MAX_NUMBER_OF_REQUEST_AT_WRONG_TIME
protected int maxReconnection
protected int maxWrongRequest
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,edu.cuny.cat.server.ClientBehaviorController.Counter>> behaviorRecords
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,edu.cuny.cat.server.ClientBehaviorController.Counter>> penaltyRecords
| Constructor Detail |
|---|
public ClientBehaviorController()
| Method Detail |
|---|
public void setup(edu.cuny.config.param.ParameterDatabase parameters,
edu.cuny.config.param.Parameter base)
setup in interface edu.cuny.config.param.Parameterizable
public void observe(java.lang.String clientId,
java.lang.String behaviorType)
clientId - the client that did the observed the activitybehaviorType - the type of behavior that may lead to penalties
public void addPenalty(java.lang.String clientId,
java.lang.String penaltyType)
clientId - penaltyType -
public int getPenalty(java.lang.String clientId,
java.lang.String penaltyType)
clientId - penaltyType -
public java.lang.String getPenaltyType(java.lang.String behaviorType)
behaviorType -
getPenaltyLevel(String)
public void penaltyExecuted(java.lang.String clientId,
java.lang.String penaltyType)
clientId - the client to be punishedpenaltyType - the type of penalty to fulfillpublic void reset()
reset in interface edu.cuny.obj.Resetablepublic java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||