Methods Summary |
---|
public void | clearoutJDBCPool()
//this will clear out the HADB connection pool
String hadbPoolname = this.getHadbJdbcConnectionPoolNameFromConfig();
if(hadbPoolname == null) {
return;
}
ResourceSpec resourceSpec = new ResourceSpec(hadbPoolname,
ResourceSpec.JNDI_NAME);
resourceSpec.setConnectionPoolName(hadbPoolname);
if(resourceSpec == null) {
return;
}
Switch.getSwitch().getPoolManager().emptyResourcePool(resourceSpec);
resourceSpec = new ResourceSpec(hadbPoolname, ResourceSpec.JDBC_URL);
resourceSpec.setConnectionPoolName(hadbPoolname);
if(resourceSpec == null) {
return;
}
Switch.getSwitch().getPoolManager().emptyResourcePool(resourceSpec);
|
public java.lang.String | getApplicationId(org.apache.catalina.Context ctx)
com.sun.enterprise.web.WebModule wm =
(com.sun.enterprise.web.WebModule)ctx;
return wm.getID();
|
public java.lang.String | getApplicationName(org.apache.catalina.Context ctx)
return ctx.getName();
|
private java.lang.String | getHadbJdbcConnectionPoolNameFromConfig()
ServerConfigLookup configLookup = new ServerConfigLookup();
return configLookup.getHadbJdbcConnectionPoolNameFromConfig();
|
public void | runCloseAllConnections()
ArrayList list = this.runGetShutdownCapables();
this.runShutdownCleanupFromShutdownCleanupCapableList(list);
|
public void | runCloseCachedConnectionForApp(java.lang.String appName)
ArrayList list = this.runGetShutdownCapablesForAppName(appName);
this.runCloseCachedConnectionFromShutdownCleanupCapableList(list, appName);
|
public void | runCloseCachedConnectionFromShutdownCleanupCapableList(java.util.ArrayList shutdownCapablesList, java.lang.String appName)
for(int i=0; i<shutdownCapablesList.size(); i++) {
ShutdownCleanupCapable nextOne = (ShutdownCleanupCapable)shutdownCapablesList.get(i);
nextOne.doCloseCachedConnection();
}
|
public java.util.ArrayList | runGetShutdownCapables()
_logger.finest("IN ConnectionShutdownUtil:runGetShutdownCapables");
//System.out.println("IN ConnectionShutdownUtil:runGetShutdownCapables");
//each element of this list will contain
//a list of connections
ArrayList shutdownCapablesList = new ArrayList();
try {
Engine[] engines = _embedded.getEngines();
for(int h=0; h<engines.length; h++) {
Container engine = (Container) engines[h];
Container[] hosts = engine.findChildren();
for(int i=0; i<hosts.length; i++) {
Container nextHost = hosts[i];
Container [] webModules = nextHost.findChildren();
for (int j=0; j<webModules.length; j++) {
Container nextWebModule = webModules[j];
Context ctx = (Context)nextWebModule;
//this code gets managers
String webAppName = this.getApplicationId(ctx);
Manager nextManager = nextWebModule.getManager();
if(nextManager instanceof ShutdownCleanupCapable) {
_logger.finest("found a shutdown capable manager:" + nextManager.getClass().getName());
//System.out.println("found a shutdown capable manager:" + nextManager.getClass().getName());
shutdownCapablesList.add(nextManager);
}
}
_logger.finest("1) shutdownCapablesList Size = " + shutdownCapablesList.size());
//System.out.println("1) shutdownCapablesList Size = " + shutdownCapablesList.size());
//now get any shutdown capable valves installed in virtual hosts
Valve[] valves = ((ContainerBase)nextHost).getValves();
for(int k=0; k<valves.length; k++) {
Valve nextValve = valves[k];
_logger.finest("VALVE = " + nextValve.getClass().getName());
//System.out.println("VALVE = " + nextValve.getClass().getName());
if(nextValve instanceof ShutdownCleanupCapable) {
_logger.finest("found a shutdown capable valve");
//System.out.println("found a shutdown capable valve");
shutdownCapablesList.add(nextValve);
}
}
}
}
} catch (Throwable th) {
_logger.log(Level.SEVERE, "Exception thrown", th);
}
_logger.finest("1) shutdownCapablesList Size = " + shutdownCapablesList.size());
//System.out.println("1) shutdownCapablesList Size = " + shutdownCapablesList.size());
return shutdownCapablesList;
|
public java.util.ArrayList | runGetShutdownCapablesForAppName(java.lang.String appName)
//FIXME this is not returning valves
_logger.finest("IN ConnectionShutdownUtil:runGetShutdownCapablesForAppName");
//System.out.println("IN ConnectionShutdownUtil:runGetShutdownCapablesForAppName");
//each element of this list will contain
//a list of connections
ArrayList shutdownCapablesList = new ArrayList();
try {
Engine[] engines = _embedded.getEngines();
for(int h=0; h<engines.length; h++) {
Container engine = (Container) engines[h];
Container[] hosts = engine.findChildren();
for(int i=0; i<hosts.length; i++) {
Container nextHost = hosts[i];
Container [] webModules = nextHost.findChildren();
for (int j=0; j<webModules.length; j++) {
Container nextWebModule = webModules[j];
Context ctx = (Context)nextWebModule;
String webAppName = this.getApplicationName(ctx);
//this code gets managers
//String webAppName = this.getApplicationId(ctx);
Manager nextManager = nextWebModule.getManager();
if(nextManager instanceof ShutdownCleanupCapable) {
if(webAppName.equals(appName)) {
_logger.finest("found a shutdown capable manager:" + nextManager.getClass().getName());
//System.out.println("found a shutdown capable manager:" + nextManager.getClass().getName());
shutdownCapablesList.add(nextManager);
}
}
}
//System.out.println("1) shutdownCapablesList Size = " + shutdownCapablesList.size());
}
}
} catch (Throwable th) {
_logger.log(Level.SEVERE, "Exception thrown", th);
}
_logger.finest("1) shutdownCapablesList Size = " + shutdownCapablesList.size());
//System.out.println("1) shutdownCapablesList Size = " + shutdownCapablesList.size());
return shutdownCapablesList;
|
public void | runShutdownCleanupFromShutdownCleanupCapableList(java.util.ArrayList shutdownCapablesList)
for(int i=0; i<shutdownCapablesList.size(); i++) {
ShutdownCleanupCapable nextOne = (ShutdownCleanupCapable)shutdownCapablesList.get(i);
nextOne.doShutdownCleanup();
}
|