[teiid-commits] teiid SVN: r1411 - in trunk: client/src/main/java/com/metamatrix/common/comm/platform/client and 2 other directories.
teiid-commits at lists.jboss.org
teiid-commits at lists.jboss.org
Fri Sep 18 16:07:15 EDT 2009
Author: rareddy
Date: 2009-09-18 16:07:15 -0400 (Fri, 18 Sep 2009)
New Revision: 1411
Modified:
trunk/adminshell/src/main/resources/scripts/util.bsh
trunk/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java
trunk/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: trunk/adminshell/src/main/resources/scripts/util.bsh
===================================================================
--- trunk/adminshell/src/main/resources/scripts/util.bsh 2009-09-18 20:05:14 UTC (rev 1410)
+++ trunk/adminshell/src/main/resources/scripts/util.bsh 2009-09-18 20:07:15 UTC (rev 1411)
@@ -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: trunk/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java 2009-09-18 20:05:14 UTC (rev 1410)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java 2009-09-18 20:07:15 UTC (rev 1411)
@@ -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: trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java 2009-09-18 20:05:14 UTC (rev 1410)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java 2009-09-18 20:07:15 UTC (rev 1411)
@@ -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: trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java
===================================================================
--- trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java 2009-09-18 20:05:14 UTC (rev 1410)
+++ trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java 2009-09-18 20:07:15 UTC (rev 1411)
@@ -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);
+ }
}
}
};
More information about the teiid-commits
mailing list