mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-12 10:45:37 +02:00
applying patch provided by Michael Berger for defect 142974
This commit is contained in:
parent
f2f189dc51
commit
85532fc260
3 changed files with 34 additions and 5 deletions
|
@ -357,6 +357,7 @@ public class ClientCommandHandler extends CommandHandler
|
||||||
document.setAttribute(DE.A_VALUE, "confirm");
|
document.setAttribute(DE.A_VALUE, "confirm");
|
||||||
document.setParent(null);
|
document.setParent(null);
|
||||||
_pendingKeepAliveConfirmation = document;
|
_pendingKeepAliveConfirmation = document;
|
||||||
|
notifyInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendKeepAliveRequest()
|
public void sendKeepAliveRequest()
|
||||||
|
@ -367,5 +368,14 @@ public class ClientCommandHandler extends CommandHandler
|
||||||
document.setAttribute(DE.A_VALUE, "request");
|
document.setAttribute(DE.A_VALUE, "request");
|
||||||
document.setParent(null);
|
document.setParent(null);
|
||||||
_pendingKeepAliveRequest = document;
|
_pendingKeepAliveRequest = document;
|
||||||
|
notifyInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void waitForInput()
|
||||||
|
{
|
||||||
|
if (_commands.size() == 0 && _classesToSend.size() == 0 && _pendingKeepAliveConfirmation == null && _pendingKeepAliveRequest == null)
|
||||||
|
{
|
||||||
|
super.waitForInput();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -438,6 +438,7 @@ public class ServerUpdateHandler extends UpdateHandler
|
||||||
document.setAttribute(DE.A_VALUE, "request");
|
document.setAttribute(DE.A_VALUE, "request");
|
||||||
document.setParent(null);
|
document.setParent(null);
|
||||||
_pendingKeepAliveRequest = document;
|
_pendingKeepAliveRequest = document;
|
||||||
|
notifyInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendKeepAliveConfirmation()
|
public void sendKeepAliveConfirmation()
|
||||||
|
@ -448,6 +449,14 @@ public class ServerUpdateHandler extends UpdateHandler
|
||||||
document.setAttribute(DE.A_VALUE, "confirm");
|
document.setAttribute(DE.A_VALUE, "confirm");
|
||||||
document.setParent(null);
|
document.setParent(null);
|
||||||
_pendingKeepAliveConfirmation = document;
|
_pendingKeepAliveConfirmation = document;
|
||||||
|
notifyInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized void waitForInput()
|
||||||
|
{
|
||||||
|
if (_dataObjects.size() == 0 && _classesToSend.size() == 0 && _pendingKeepAliveConfirmation == null && _pendingKeepAliveRequest == null)
|
||||||
|
{
|
||||||
|
super.waitForInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -50,6 +50,7 @@ public class XMLparser
|
||||||
|
|
||||||
public static final int IO_SOCKET_READ_TIMEOUT = 3600000;
|
public static final int IO_SOCKET_READ_TIMEOUT = 3600000;
|
||||||
public static final long KEEPALIVE_RESPONSE_TIMEOUT = 60000;
|
public static final long KEEPALIVE_RESPONSE_TIMEOUT = 60000;
|
||||||
|
public static final boolean VERBOSE_KEEPALIVE = false;
|
||||||
|
|
||||||
private DataStore _dataStore;
|
private DataStore _dataStore;
|
||||||
private DataElement _rootDataElement;
|
private DataElement _rootDataElement;
|
||||||
|
@ -301,6 +302,7 @@ public class XMLparser
|
||||||
{
|
{
|
||||||
_initialKart = new KeepAliveRequestThread(KEEPALIVE_RESPONSE_TIMEOUT, _dataStore);
|
_initialKart = new KeepAliveRequestThread(KEEPALIVE_RESPONSE_TIMEOUT, _dataStore);
|
||||||
_firstTime = false;
|
_firstTime = false;
|
||||||
|
if (VERBOSE_KEEPALIVE) System.out.println("Starting initial KeepAlive thread.");
|
||||||
_initialKart.start();
|
_initialKart.start();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -309,11 +311,13 @@ public class XMLparser
|
||||||
if (!_initialKart.failed())
|
if (!_initialKart.failed())
|
||||||
{
|
{
|
||||||
_isKeepAliveCompatible = true;
|
_isKeepAliveCompatible = true;
|
||||||
|
if (VERBOSE_KEEPALIVE) System.out.println("KeepAlive compatible.");
|
||||||
_initialKart = null;
|
_initialKart = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_isKeepAliveCompatible = false;
|
_isKeepAliveCompatible = false;
|
||||||
|
if (VERBOSE_KEEPALIVE) System.out.println("KeepAlive incompatible.");
|
||||||
_initialKart = null;
|
_initialKart = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -332,12 +336,14 @@ public class XMLparser
|
||||||
if ((_kart != null) && _kart.failed())
|
if ((_kart != null) && _kart.failed())
|
||||||
{
|
{
|
||||||
done = true;
|
done = true;
|
||||||
handlePanic(new Exception("KeepAlive request to client wasnt answered in time."));
|
if (_dataStore.isVirtual()) handlePanic(new Exception("KeepAlive request to server wasnt answered in time."));
|
||||||
|
else handlePanic(new Exception("KeepAlive request to client wasnt answered in time."));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_kart = new KeepAliveRequestThread(KEEPALIVE_RESPONSE_TIMEOUT, _dataStore);
|
_kart = new KeepAliveRequestThread(KEEPALIVE_RESPONSE_TIMEOUT, _dataStore);
|
||||||
|
if (VERBOSE_KEEPALIVE) System.out.println("No activity on socket. KeepAlive thread started.");
|
||||||
_kart.start();
|
_kart.start();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -610,11 +616,13 @@ public class XMLparser
|
||||||
}
|
}
|
||||||
else if (_isKeepAlive && (result != null))
|
else if (_isKeepAlive && (result != null))
|
||||||
{
|
{
|
||||||
|
if (VERBOSE_KEEPALIVE) System.out.println("KeepAlive request received, sending confirmation.");
|
||||||
result.getDataStore().sendKeepAliveConfirmation();
|
result.getDataStore().sendKeepAliveConfirmation();
|
||||||
_isKeepAlive = false;
|
_isKeepAlive = false;
|
||||||
}
|
}
|
||||||
else if (_isKeepAliveConfirm && (result != null))
|
else if (_isKeepAliveConfirm && (result != null))
|
||||||
{
|
{
|
||||||
|
if (VERBOSE_KEEPALIVE) System.out.println("KeepAlive confirmation received.");
|
||||||
if (_initialKart != null) _initialKart.interrupt();
|
if (_initialKart != null) _initialKart.interrupt();
|
||||||
_isKeepAliveConfirm = false;
|
_isKeepAliveConfirm = false;
|
||||||
}
|
}
|
||||||
|
@ -1004,8 +1012,10 @@ public class XMLparser
|
||||||
}
|
}
|
||||||
catch (InterruptedException e)
|
catch (InterruptedException e)
|
||||||
{
|
{
|
||||||
|
if (VERBOSE_KEEPALIVE) System.out.println("KeepAlive thread interrupted.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (VERBOSE_KEEPALIVE) System.out.println("KeepAlive thread failed to be interrupted.");
|
||||||
_failed = true;
|
_failed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue