*
* @param executionId the ID of the task to be unregistered
* @param task the task to be unregistered
*/
public void unregister(ExecutionAttemptID executionId, Task task) {
final Environment environment = task.getEnvironment();
if (environment == null) {
return;
}
// destroy and remove OUTPUT channels from registered channels and cache
for (ChannelID id : environment.getOutputChannelIDs()) {
Channel channel = this.channels.remove(id);
if (channel != null) {
channel.destroy();
this.receiverCache.remove(channel);
}
}
// destroy and remove INPUT channels from registered channels and cache
for (ChannelID id : environment.getInputChannelIDs()) {
Channel channel = this.channels.remove(id);
if (channel != null) {
channel.destroy();
this.receiverCache.remove(channel);
}
}
// clear and remove INPUT side buffer pools
for (GateID id : environment.getInputGateIDs()) {
LocalBufferPoolOwner bufferPool = this.localBuffersPools.remove(id);
if (bufferPool != null) {
bufferPool.clearLocalBufferPool();
}
}