int count = getObjectCount();
// Create channel with managed ChannelListener.
txnScheduler.runTask(new TestAbstractKernelRunnable() {
public void run() {
ManagedChannelListener listener = new ManagedChannelListener();
Channel channel = AppContext.getChannelManager().
createChannel(channelName, listener, Delivery.RELIABLE);
DataManager dataManager = AppContext.getDataManager();
dataManager.setBinding(channelName, channel);
dataManager.setBinding(listenerName, listener);
}
}, taskOwner);
printServiceBindings("after channel create");
// Remove managed channel listener and close channel.
txnScheduler.runTask(new TestAbstractKernelRunnable() {
public void run() {
DataManager dataManager = AppContext.getDataManager();
ManagedChannelListener listener = (ManagedChannelListener)
dataManager.getBinding(listenerName);
Channel channel = (Channel) dataManager.getBinding(channelName);
dataManager.removeBinding(listenerName);
if (removeListener) {
dataManager.removeObject(listener);
}
dataManager.removeObject(channel);
}
}, taskOwner);
Thread.sleep(100);
txnScheduler.runTask(new TestAbstractKernelRunnable() {
public void run() {
Channel channel = getChannel(channelName);
if (getChannel(channelName) != null) {
fail("obtained closed channel");
}
}
}, taskOwner);