/** Releases the channels. */ private void freeChannels() { for (ChannelInfo info : channels.values()) { freePacket(info.getReadPacket()); freePacket(info.getWritePacket()); } channels.clear(); }
/** * Setter for last read packet. * * @param channelId Channel id * @param packet Packet */ public void setLastReadPacket(int channelId, Packet packet) { final ChannelInfo info = getChannelInfo(channelId); // grab last packet Packet prevPacket = info.getReadPacket(); // set new one info.setReadPacket(packet); // free the previous packet freePacket(prevPacket); }