if (c!= null) utf.removeCache(c);
if (c != null) // && ( (c.getCacheStatus() == CacheStatus.STARTED) || c.getCacheStatus() == CacheStatus.FAILED) )
{
CacheSPI spi = (CacheSPI) c;
Channel channel = null;
if (spi.getRPCManager() != null)
{
channel = spi.getRPCManager().getChannel();
}
if (spi.getTransactionManager() != null)
{
try
{
spi.getTransactionManager().rollback();
}
catch (Throwable t)
{
// don't care
}
}
CacheLoaderManager clm = spi.getCacheLoaderManager();
CacheLoader cl = clm == null ? null : clm.getCacheLoader();
if (cl != null)
{
try
{
cl.remove(Fqn.ROOT);
}
catch (Throwable t)
{
// don't care
}
}
try
{
spi.stop();
} catch (Throwable t) {
System.out.println(Thread.currentThread().getName() + " !!!!!!!!!!!!!!!!!!!!! WARNING - Cache instance refused to stop.");
t.printStackTrace();
}
try {
spi.destroy();
} catch (Throwable t) {
System.out.println(Thread.currentThread().getName() + " !!!!!!!!!!!!!!!!!!!!! WARNING - Cache instance refused to destroy.");
t.printStackTrace();
}
if (channel != null)
{
if (channel.isOpen()) {
System.out.println(Thread.currentThread().getName() + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Channel still opened.");
Thread.dumpStack();
channel.close();
}
if (channel.isOpen()) {
System.out.println(Thread.currentThread().getName() + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Channel close failed.");
System.exit(-1);
}
if (channel.isConnected()) {
System.out.println(Thread.currentThread().getName() + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Channel still connected.");
Thread.dumpStack();
System.exit(-1);
}
}