Author: rareddy
Date: 2009-09-18 16:05:14 -0400 (Fri, 18 Sep 2009)
New Revision: 1410
Modified:
branches/6.2.x/adminshell/src/main/resources/scripts/util.bsh
branches/6.2.x/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java
branches/6.2.x/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java
branches/6.2.x/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java
Log:
TEIID-839 - admin connection does not use VDB, so there will not be any VDB in the
connection properties. Also, reconnecting proxy in ServeradminFacory does not recycle the
connection when CommunicationException occurs.
Modified: branches/6.2.x/adminshell/src/main/resources/scripts/util.bsh
===================================================================
--- branches/6.2.x/adminshell/src/main/resources/scripts/util.bsh 2009-09-18 20:00:24 UTC
(rev 1409)
+++ branches/6.2.x/adminshell/src/main/resources/scripts/util.bsh 2009-09-18 20:05:14 UTC
(rev 1410)
@@ -2,6 +2,7 @@
import org.teiid.adminapi.*;
import com.metamatrix.core.util.*;
import java.lang.reflect.*;
+import com.metamatrix.common.comm.exception.*;
debug=false;
@@ -194,10 +195,23 @@
throw ex;
}
} catch(Throwable t) {
- msg = t.getMessage();
- if (msg != null) {
- print(msg);
+ if (interactive()) {
+ msg = t.getMessage();
+ if (msg != null) {
+ print(msg);
+ }
+ t = t.getCause();
+ if (t instanceof SingleInstanceCommunicationException) {
+ print("Lost Connection; disconnecting..");
+ disconnect();
+ }
+ debug(t);
}
+ else {
+ print("Lost Connection; disconnecting..");
+ disconnect();
+ throw t;
+ }
}
return null;
}
Modified:
branches/6.2.x/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java
===================================================================
---
branches/6.2.x/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java 2009-09-18
20:00:24 UTC (rev 1409)
+++
branches/6.2.x/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java 2009-09-18
20:05:14 UTC (rev 1410)
@@ -96,9 +96,14 @@
try {
return method.invoke(getTarget(), args);
} catch (InvocationTargetException e) {
- if (method.getName().endsWith("restart") &&
ExceptionUtil.getExceptionOfType(e, CommunicationException.class) != null) {
//$NON-NLS-1$
- bounceSystem(true);
- return null;
+ if (ExceptionUtil.getExceptionOfType(e, CommunicationException.class) != null) {
+ // communication exception occurred, lose the old connection and try again.
+ this.target = null;
+ if (method.getName().endsWith("restart")) { //$NON-NLS-1$
+ bounceSystem(true);
+ return null;
+ }
+ continue;
}
throw e.getTargetException();
} catch (CommunicationException e) {
@@ -128,6 +133,7 @@
} catch (InterruptedException e) {
throw new MetaMatrixRuntimeException(e);
}
+
//we'll wait 30 seconds for the server to come back up
for (int i = 0; i < 15; i++) {
try {
Modified:
branches/6.2.x/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java
===================================================================
---
branches/6.2.x/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java 2009-09-18
20:00:24 UTC (rev 1409)
+++
branches/6.2.x/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java 2009-09-18
20:05:14 UTC (rev 1410)
@@ -108,7 +108,7 @@
return;
}
} catch (InvalidSessionException e) {
- shutdown();
+ shutdown(false);
} catch (MetaMatrixComponentException e) {
shutdown();
}
@@ -143,17 +143,17 @@
Exception ex = null;
try {
SocketServerInstance instance = connectionFactory.getServerInstance(hostInfo,
secure);
+ this.serverInstance = instance;
if (this.logonResult != null) {
ILogon newLogon = instance.getService(ILogon.class);
newLogon.assertIdentity(logonResult.getSessionToken());
}
this.serverDiscovery.connectionSuccessful(hostInfo);
- this.serverInstance = instance;
return this.serverInstance;
} catch (IOException e) {
ex = e;
} catch (InvalidSessionException e) {
- shutdown();
+ shutdown(false);
throw new
CommunicationException(e,CommPlatformPlugin.Util.getString("SocketServerInstance.Connection_Error.Connect_Failed",
hostInfo.getHostName(), String.valueOf(hostInfo.getPortNumber()), e.getMessage()));
//$NON-NLS-1$
} catch (SingleInstanceCommunicationException e) {
ex = e;
@@ -244,23 +244,28 @@
public <T> T getService(Class<T> iface) {
return (T)Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] {iface},
new ServerConnectionInvocationHandler(iface));
}
-
public synchronized void shutdown() {
+ shutdown(true);
+ }
+ private synchronized void shutdown(boolean logoff) {
if (this.closed) {
return;
}
- try {
- //make a best effort to send the logoff
- Future<?> writeFuture = this.logon.logoff();
- writeFuture.get(5000, TimeUnit.MILLISECONDS);
- } catch (InvalidSessionException e) {
- //ignore
- } catch (InterruptedException e) {
- //ignore
- } catch (ExecutionException e) {
- //ignore
- } catch (TimeoutException e) {
- //ignore
+
+ if (logoff) {
+ try {
+ //make a best effort to send the logoff
+ Future<?> writeFuture = this.logon.logoff();
+ writeFuture.get(5000, TimeUnit.MILLISECONDS);
+ } catch (InvalidSessionException e) {
+ //ignore
+ } catch (InterruptedException e) {
+ //ignore
+ } catch (ExecutionException e) {
+ //ignore
+ } catch (TimeoutException e) {
+ //ignore
+ }
}
closeServerInstance();
Modified:
branches/6.2.x/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java
===================================================================
---
branches/6.2.x/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java 2009-09-18
20:00:24 UTC (rev 1409)
+++
branches/6.2.x/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java 2009-09-18
20:05:14 UTC (rev 1410)
@@ -1214,11 +1214,12 @@
* A Client Connection to DQP has been removed
*/
public void sessionClosed(MetaMatrixSessionInfo session) {
-
String vdbName = session.getProductInfo(ProductInfoConstants.VIRTUAL_DB);
String vdbVersion =
session.getProductInfo(ProductInfoConstants.VDB_VERSION);
- if (canDeleteVDB(vdbName, vdbVersion)) {
- runVDBCleanUp(vdbName, vdbVersion);
+ if (vdbName != null && vdbVersion != null) {
+ if (canDeleteVDB(vdbName, vdbVersion)) {
+ runVDBCleanUp(vdbName, vdbVersion);
+ }
}
}
};