mirror of
https://github.com/correl/mage.git
synced 2025-04-10 01:01:05 -09:00
Added -Ddebug.mage parameter for Mage.Client to disable timeout for debugging (got disconnected while debugging server code in IDEA).
This commit is contained in:
parent
5ad77e8a88
commit
5bb236def0
1 changed files with 13 additions and 10 deletions
|
@ -77,14 +77,11 @@ public class Session {
|
||||||
private SessionState sessionState = SessionState.DISCONNECTED;
|
private SessionState sessionState = SessionState.DISCONNECTED;
|
||||||
private Connection connection;
|
private Connection connection;
|
||||||
|
|
||||||
/**
|
private static boolean debugMode = false;
|
||||||
* For locking session object.
|
|
||||||
* Read-write locking is used for better performance, as in most cases session object won't be changed so
|
static {
|
||||||
* there shouldn't be any penalty for synchronization.
|
debugMode = System.getProperty("debug.mage") != null;
|
||||||
*
|
}
|
||||||
* @author nantuko
|
|
||||||
*/
|
|
||||||
// private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
|
|
||||||
|
|
||||||
public Session(MageClient client) {
|
public Session(MageClient client) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
|
@ -135,8 +132,14 @@ public class Session {
|
||||||
callbackClient = new Client(clientLocator, "callback", clientMetadata);
|
callbackClient = new Client(clientLocator, "callback", clientMetadata);
|
||||||
|
|
||||||
Map<String, String> listenerMetadata = new HashMap<String, String>();
|
Map<String, String> listenerMetadata = new HashMap<String, String>();
|
||||||
listenerMetadata.put(ConnectionValidator.VALIDATOR_PING_PERIOD, "10000");
|
if (debugMode) {
|
||||||
listenerMetadata.put(ConnectionValidator.VALIDATOR_PING_TIMEOUT, "9000");
|
// prevent client from disconnecting while debugging
|
||||||
|
listenerMetadata.put(ConnectionValidator.VALIDATOR_PING_PERIOD, "1000000");
|
||||||
|
listenerMetadata.put(ConnectionValidator.VALIDATOR_PING_TIMEOUT, "900000");
|
||||||
|
} else {
|
||||||
|
listenerMetadata.put(ConnectionValidator.VALIDATOR_PING_PERIOD, "10000");
|
||||||
|
listenerMetadata.put(ConnectionValidator.VALIDATOR_PING_TIMEOUT, "9000");
|
||||||
|
}
|
||||||
callbackClient.connect(new ClientConnectionListener(), listenerMetadata);
|
callbackClient.connect(new ClientConnectionListener(), listenerMetadata);
|
||||||
|
|
||||||
Map<String, String> callbackMetadata = new HashMap<String, String>();
|
Map<String, String> callbackMetadata = new HashMap<String, String>();
|
||||||
|
|
Loading…
Add table
Reference in a new issue