}
}
private void setPartitionInChannel(JChannel channel, int slaveIndex, Set<Integer> members) {
log.trace("Setting partition in channel " + channel);
SLAVE_PARTITION partition = (SLAVE_PARTITION) channel.getProtocolStack().findProtocol(getPartitionProtocolClass());
if (partition == null) {
log.info("No SLAVE_PARTITION protocol found in stack for " + channel.getName() + ", inserting above transport protocol");
try {
partition = getPartitionProtocolClass().newInstance();
} catch (Exception e) {
log.error("Error creating SLAVE_PARTITION protocol", e);
return;
}
try {
channel.getProtocolStack().insertProtocol(partition, ProtocolStack.ABOVE, TP.class);
} catch (Exception e) {
log.error("Error inserting the SLAVE_PARTITION protocol to stack for " + channel.getName());
return;
}
}
partition.setSlaveIndex(slaveIndex);
partition.setAllowedSlaves(members);
log.trace("Finished setting partition in channel " + channel);
}