1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-15 21:15:23 +02:00

[244388] [dstore] Connection hangs when a miner not installed

This commit is contained in:
David McKnight 2008-08-18 12:49:20 +00:00
parent 256ae988c9
commit 34144af27c
4 changed files with 36 additions and 11 deletions

View file

@ -12,6 +12,7 @@
* *
* Contributors: * Contributors:
* David McKnight (IBM) - [226561] [apidoc] Add API markup to RSE Javadocs where extend / implement is allowed * David McKnight (IBM) - [226561] [apidoc] Add API markup to RSE Javadocs where extend / implement is allowed
* David McKnight (IBM) - [244388] [dstore] Connection hangs when a miner not installed
********************************************************************************/ ********************************************************************************/
package org.eclipse.dstore.core.java; package org.eclipse.dstore.core.java;
@ -169,8 +170,6 @@ public class RemoteClassLoader extends ClassLoader
*/ */
protected Class findClass(String className) throws ClassNotFoundException protected Class findClass(String className) throws ClassNotFoundException
{ {
//System.out.println("finding "+className);
// first try using the datastore's local classloaders // first try using the datastore's local classloaders
ArrayList localLoaders = _dataStore.getLocalClassLoaders(); ArrayList localLoaders = _dataStore.getLocalClassLoaders();
@ -186,6 +185,7 @@ public class RemoteClassLoader extends ClassLoader
} }
catch (Exception e) catch (Exception e)
{ {
e.printStackTrace();
} }
} }
} }
@ -202,6 +202,7 @@ public class RemoteClassLoader extends ClassLoader
} }
catch (Exception e) catch (Exception e)
{ {
e.printStackTrace();
} }
// DKM // DKM
@ -246,9 +247,13 @@ public class RemoteClassLoader extends ClassLoader
} }
else if (!request.isLoaded()) else if (!request.isLoaded())
{ {
System.out.println("request is not loaded");
// the class has been requested before, but it has not yet been received // the class has been requested before, but it has not yet been received
// System.out.println(className + " already requested but not loaded. Waiting for request to load."); // System.out.println(className + " already requested but not loaded. Waiting for request to load.");
System.out.println("waiting for response...");
request.waitForResponse(); // just wait until the class is received request.waitForResponse(); // just wait until the class is received
System.out.println("...finished waiting for response");
// after the class is received, get it from the repository and return it // after the class is received, get it from the repository and return it
// or if the class failed to be received, throw an exception // or if the class failed to be received, throw an exception
@ -263,7 +268,9 @@ public class RemoteClassLoader extends ClassLoader
} }
// if we ever get to this point, the class has not been found, // if we ever get to this point, the class has not been found,
// throw the exception // throw the exception
else throw new ClassNotFoundException(className); else {
throw new ClassNotFoundException(className);
}
} }
@ -396,7 +403,6 @@ public class RemoteClassLoader extends ClassLoader
public Class requestClass(String className) throws ClassNotFoundException public Class requestClass(String className) throws ClassNotFoundException
{ {
// first check to see if the class has been requested before // first check to see if the class has been requested before
// System.out.println("requesting "+className);
ClassRequest request; ClassRequest request;
request = (ClassRequest) _dataStore.getClassRequestRepository().get(className); request = (ClassRequest) _dataStore.getClassRequestRepository().get(className);
if (request == null) if (request == null)
@ -415,7 +421,13 @@ public class RemoteClassLoader extends ClassLoader
if (!request.isLoaded()) request.waitForResponse(); if (!request.isLoaded()) request.waitForResponse();
// System.out.println("thread finished waiting: "+Thread.currentThread().getName()); // System.out.println("thread finished waiting: "+Thread.currentThread().getName());
if (request.isLoaded()) return request.getLoadedClass(); if (request.isLoaded()) return request.getLoadedClass();
else throw new ClassNotFoundException(className); else {
// remove the request so that if another one comes in for the
// same thing it doesn't hang waiting for a response
_dataStore.getClassRequestRepository().remove(className);
throw new ClassNotFoundException(className);
}
} }
else if (!request.isLoaded()) else if (!request.isLoaded())
{ {
@ -444,6 +456,7 @@ public class RemoteClassLoader extends ClassLoader
*/ */
public synchronized void loadClassInThread(String className) public synchronized void loadClassInThread(String className)
{ {
//System.out.println("remote load of "+className);
// check if the class has been requested before // check if the class has been requested before
ClassRequest request; ClassRequest request;
request = (ClassRequest) _dataStore.getClassRequestRepository().get(className); request = (ClassRequest) _dataStore.getClassRequestRepository().get(className);

View file

@ -12,7 +12,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
* *
* Contributors: * Contributors:
* {Name} (company) - description of contribution. * David McKnight (IBM) - [244388] [dstore] Connection hangs when a miner not installed
*******************************************************************************/ *******************************************************************************/
package org.eclipse.dstore.internal.core.server; package org.eclipse.dstore.internal.core.server;
@ -206,6 +206,9 @@ public class MinerLoader implements ISchemaRegistry
miner.setExternalLoader(loader); miner.setExternalLoader(loader);
_minerList.add(name); _minerList.add(name);
} }
else {
System.out.println("miner is null");
}
} }
} }
catch (NoClassDefFoundError e) catch (NoClassDefFoundError e)
@ -239,8 +242,10 @@ public class MinerLoader implements ISchemaRegistry
private void handleNoClassFound(String name) private void handleNoClassFound(String name)
{ {
if (_remoteLoader != null){
_remoteLoader.loadClassInThread(name); _remoteLoader.loadClassInThread(name);
} }
}
private void connectMiners(ArrayList unconnectedMiners) private void connectMiners(ArrayList unconnectedMiners)
{ {

View file

@ -13,6 +13,7 @@
* *
* Contributors: * Contributors:
* David McKnight (IBM) [224906] [dstore] changes for getting properties and doing exit due to single-process capability * David McKnight (IBM) [224906] [dstore] changes for getting properties and doing exit due to single-process capability
* David McKnight (IBM) - [244388] [dstore] Connection hangs when a miner not installed
*******************************************************************************/ *******************************************************************************/
package org.eclipse.dstore.internal.core.server; package org.eclipse.dstore.internal.core.server;
@ -312,7 +313,13 @@ public class ServerCommandHandler extends CommandHandler
DataElement minerId = command.get(0); DataElement minerId = command.get(0);
String minerName = minerId.getName(); String minerName = minerId.getName();
Miner miner = loadMiner(minerName); Miner miner = loadMiner(minerName);
if (miner != null){
miner.initMiner(status); miner.initMiner(status);
}
else { // failed to load miner
status.setAttribute(DE.A_NAME,DataStoreResources.model_done);
status.setAttribute(DE.A_VALUE, DataStoreResources.model_failed);
}
//System.out.println("finished initing "+miner.getMinerName()); //System.out.println("finished initing "+miner.getMinerName());
//status.setAttribute(DE.A_NAME,DataStoreResources.model_done); //status.setAttribute(DE.A_NAME,DataStoreResources.model_done);
} }

View file

@ -12,7 +12,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
* *
* Contributors: * Contributors:
* {Name} (company) - description of contribution. * David McKnight (IBM) - [244388] [dstore] Connection hangs when a miner not installed
*******************************************************************************/ *******************************************************************************/
package org.eclipse.dstore.internal.core.util; package org.eclipse.dstore.internal.core.util;