Theres some mixing up between ComAdapter and EvAComAdapter using the IslandModelEA. It now works, yet Im not sure what really goes on.

This commit is contained in:
Marcel Kronfeld 2008-04-04 16:10:26 +00:00
parent 475e488b27
commit 50511b0ed5
3 changed files with 20 additions and 10 deletions

View File

@ -571,6 +571,7 @@ public class EvAClient implements RemoteStateListener, Serializable {
URL baseDir = this.getClass().getClassLoader().getResource("");
String cp = System.getProperty("java.class.path",".");
if (!cp.contains(baseDir.getPath())) {
// this was added due to matlab not adding base dir to base path...
System.err.println("classpath does not contain base directory!");
System.err.println("adding base dir and trying again...");
System.setProperty("java.class.path", cp + System.getProperty("path.separator") + baseDir.getPath());

View File

@ -112,7 +112,12 @@ public class EvAComAdapter extends ComAdapter {
}
protected MainAdapter getMainAdapter(RMIInvocationHandler invocHandler) throws RemoteException {
return (EvAMainAdapter) invocHandler.getWrapper();
try {
return (EvAMainAdapter) invocHandler.getWrapper();
} catch (ClassCastException e) {
System.err.println("Warning: cannot cast to EvAMainAdapter in EvAComAdapter.. trying MainAdapter...");
}
return (MainAdapter) invocHandler.getWrapper();
}
protected void logInfo(String msg) {

View File

@ -23,8 +23,6 @@ import java.lang.reflect.Method;
public class RMIProxyRemoteThread implements InvocationHandler,
Serializable {
private static ComAdapter m_Adapter;
private Object m_Object;
private String m_ObjectName;
private RMIThreadInvocationHandler m_RMIThreadHandler;
/**
*
@ -44,19 +42,25 @@ public class RMIProxyRemoteThread implements InvocationHandler,
c.getClass().getInterfaces(),
new RMIProxyRemoteThread(c,host));
}
private static void maybeLoadAdapter() {
if (m_Adapter==null)
m_Adapter = ComAdapter.getInstance();
}
/**
*
* @param c
* @return
*/
public static String[] getServerList() {
if (m_Adapter==null) m_Adapter = ComAdapter.getInstance();
maybeLoadAdapter();
m_Adapter.evalAvailableHostNameList();
return m_Adapter.getAvailableHostNameList();
}
public static void setServerList(String[] servers ) {
if (m_Adapter==null) m_Adapter = ComAdapter.getInstance();
maybeLoadAdapter();
m_Adapter.setServerList(servers);
m_Adapter.evalAvailableHostNameList();
@ -82,15 +86,15 @@ public class RMIProxyRemoteThread implements InvocationHandler,
*
*/
private RMIProxyRemoteThread (Object c, String host) {
m_ObjectName = c.getClass().getName();
if (m_Adapter==null) m_Adapter = ComAdapter.getInstance();
// m_ObjectName = c.getClass().getName();
maybeLoadAdapter();
m_RMIThreadHandler = m_Adapter.getRMIThreadHandler(c,host);
}
/**
*
*/
private RMIProxyRemoteThread (Object c, MainAdapterClient Client) {
m_ObjectName = c.getClass().getName();
// m_ObjectName = c.getClass().getName();
try {
m_RMIThreadHandler = Client.getRMIThreadHandler(c);
} catch (Exception e) {
@ -102,8 +106,8 @@ public class RMIProxyRemoteThread implements InvocationHandler,
*
*/
private RMIProxyRemoteThread (Object c) {
m_ObjectName = c.getClass().getName();
if (m_Adapter==null) m_Adapter = ComAdapter.getInstance();
// m_ObjectName = c.getClass().getName();
maybeLoadAdapter();
m_RMIThreadHandler = m_Adapter.getRMIThreadHandler(c);
}
/**