1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 14:55:41 +02:00

[220123] [api][dstore] Configurable timeout on irresponsiveness

This commit is contained in:
David McKnight 2008-03-07 14:11:13 +00:00
parent 64239d6800
commit bc27d20ae0
3 changed files with 65 additions and 33 deletions

View file

@ -82,6 +82,7 @@ public class XMLparser
private Throwable _panicException = null;
private boolean _isKeepAliveCompatible = false;
private boolean _isKeepAliveEnabled = true;
private boolean _firstTime = true;
private KeepAliveRequestThread _kart = null;
@ -131,6 +132,7 @@ public class XMLparser
public void setEnableKeepalive(boolean enable){
// if false, we ignore the keepalive stuff
_isKeepAliveCompatible = enable;
_isKeepAliveEnabled = enable;
}
/**
@ -308,34 +310,36 @@ public class XMLparser
boolean inquotes = false;
while (!done)
{
if (_firstTime)
if (_isKeepAliveEnabled)
{
_initialKart = new KeepAliveRequestThread(KEEPALIVE_RESPONSE_TIMEOUT);
_firstTime = false;
if (VERBOSE_KEEPALIVE) System.out.println("Starting initial KeepAlive thread."); //$NON-NLS-1$
_initialKart.start();
continue;
}
else if (_initialKart != null && !_initialKart.isAlive())
{
if (!_initialKart.failed())
if (_firstTime)
{
_isKeepAliveCompatible = true;
if (VERBOSE_KEEPALIVE) System.out.println("KeepAlive compatible."); //$NON-NLS-1$
_initialKart = null;
}
else
_initialKart = new KeepAliveRequestThread(KEEPALIVE_RESPONSE_TIMEOUT);
_firstTime = false;
if (VERBOSE_KEEPALIVE) System.out.println("Starting initial KeepAlive thread."); //$NON-NLS-1$
_initialKart.start();
continue;
}
else if (_initialKart != null && !_initialKart.isAlive())
{
_isKeepAliveCompatible = false;
if (VERBOSE_KEEPALIVE) System.out.println("KeepAlive incompatible."); //$NON-NLS-1$
_initialKart = null;
if (!_initialKart.failed())
{
_isKeepAliveCompatible = true;
if (VERBOSE_KEEPALIVE) System.out.println("KeepAlive compatible."); //$NON-NLS-1$
_initialKart = null;
}
else
{
_isKeepAliveCompatible = false;
if (VERBOSE_KEEPALIVE) System.out.println("KeepAlive incompatible."); //$NON-NLS-1$
_initialKart = null;
}
}
}
int in = -1;
if (_isKeepAliveCompatible)
if (_isKeepAliveEnabled && _isKeepAliveCompatible)
{
socket.setSoTimeout(IO_SOCKET_READ_TIMEOUT);
try
@ -349,14 +353,16 @@ public class XMLparser
done = true;
if (_dataStore.isVirtual()) handlePanic(new Exception("KeepAlive request to server wasnt answered in time.")); //$NON-NLS-1$
else handlePanic(new Exception("KeepAlive request to client wasnt answered in time.")); //$NON-NLS-1$
continue;
return null;
}
else
{
_kart = new KeepAliveRequestThread(KEEPALIVE_RESPONSE_TIMEOUT);
if (VERBOSE_KEEPALIVE) System.out.println("No activity on socket. KeepAlive thread started."); //$NON-NLS-1$
_kart.start();
continue;
if (_kart == null){
_kart = new KeepAliveRequestThread(KEEPALIVE_RESPONSE_TIMEOUT);
if (VERBOSE_KEEPALIVE) System.out.println("No activity on socket. KeepAlive thread started."); //$NON-NLS-1$
_kart.start();
continue;
}
}
}
}
@ -671,7 +677,7 @@ public class XMLparser
}
else if (_isKeepAlive)
{
if (VERBOSE_KEEPALIVE) System.out.println("KeepAlive request received, sending confirmation."); //$NON-NLS-1$
if (VERBOSE_KEEPALIVE) System.out.println("KeepAlive request received, sending confirmation."); //$NON-NLS-1$
result.getDataStore().sendKeepAliveConfirmation();
_isKeepAlive = false;
}

View file

@ -26,6 +26,7 @@
* David McKnight (IBM) - [218685] [api][breaking][dstore] Unable to connect when using SSL.
* David McKnight (IBM) - [220123][dstore] Configurable timeout on irresponsiveness
* David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
* David McKnight (IBM) - [220123] [api][dstore] Configurable timeout on irresponsiveness
*******************************************************************************/
package org.eclipse.rse.connectorservice.dstore;
@ -963,7 +964,7 @@ public class DStoreConnectorService extends StandardConnectorService implements
// this preference is set on the server side
dataStore.setPreference(RemoteClassLoader.CACHING_PREFERENCE, cacheRemoteClasses ? "true" : "false", true); //$NON-NLS-1$ //$NON-NLS-2$
if (serverVersion >= 9){ // keepalive preferences
if (serverVersion >= 8){ // keepalive preferences
boolean doKeepalive = store.getBoolean(IUniversalDStoreConstants.RESID_PREF_DO_KEEPALIVE);
int keepaliveResponseTimeout = store.getInt(IUniversalDStoreConstants.RESID_PREF_KEEPALIVE_RESPONSE_TIMEOUT);

View file

@ -13,13 +13,13 @@
* Contributors:
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
* David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
* David McKnight (IBM) - [220123] [api][dstore] Configurable timeout on irresponsiveness
********************************************************************************/
package org.eclipse.rse.internal.connectorservice.dstore;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.rse.connectorservice.dstore.IUniversalDStoreConstants;
import org.eclipse.rse.ui.ISystemPreferencesConstants;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemBasePlugin;
import org.osgi.framework.BundleContext;
@ -48,11 +48,36 @@ public class Activator extends SystemBasePlugin {
public void start(BundleContext context) throws Exception
{
super.start(context);
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
store.setDefault(IUniversalDStoreConstants.RESID_PREF_SOCKET_TIMEOUT, IUniversalDStoreConstants.DEFAULT_PREF_SOCKET_TIMEOUT);
store.setDefault(ISystemPreferencesConstants.ALERT_SSL, ISystemPreferencesConstants.DEFAULT_ALERT_SSL);
store.setDefault(ISystemPreferencesConstants.ALERT_NONSSL, ISystemPreferencesConstants.DEFAULT_ALERT_NON_SSL);
initializeDefaultPreferences();
}
public void initializeDefaultPreferences() {
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
int timeout = IUniversalDStoreConstants.DEFAULT_PREF_SOCKET_TIMEOUT;
store.setDefault(IUniversalDStoreConstants.RESID_PREF_SOCKET_TIMEOUT, timeout);
// do keepalive
boolean doKeepalive = IUniversalDStoreConstants.DEFAULT_PREF_DO_KEEPALIVE;
store.setValue(IUniversalDStoreConstants.RESID_PREF_DO_KEEPALIVE, doKeepalive);
// socket read timeout
int socketTimeout = IUniversalDStoreConstants.DEFAULT_PREF_SOCKET_READ_TIMEOUT;
store.setDefault(IUniversalDStoreConstants.RESID_PREF_SOCKET_READ_TIMEOUT, socketTimeout);
// keepalive response timeout
int keepaliveTimeout = IUniversalDStoreConstants.DEFAULT_PREF_KEEPALIVE_RESPONSE_TIMEOUT;
store.setDefault(IUniversalDStoreConstants.RESID_PREF_KEEPALIVE_RESPONSE_TIMEOUT, keepaliveTimeout);
// show mismatched server warning
boolean showMismatchedWarning = IUniversalDStoreConstants.DEFAULT_ALERT_MISMATCHED_SERVER;
store.setDefault(IUniversalDStoreConstants.ALERT_MISMATCHED_SERVER, showMismatchedWarning);
// cache remote classes
boolean cacheRemoteClasses = IUniversalDStoreConstants.DEFAULT_PREF_CACHE_REMOTE_CLASSES;
store.setDefault(IUniversalDStoreConstants.RESID_PREF_CACHE_REMOTE_CLASSES, cacheRemoteClasses);
}
/**