oldTopic.lock.readLock().lock();
int oldTopicNum = oldTopic.getNum();
long oldTopicLastMod = oldTopic.getLastModTimestamp();
oldTopic.lock.readLock().unlock();
Topic newTopic = threadMap.remove(oldTopicNum);
if(newTopic != null) {
if(oldTopicLastMod < newTopic.getLastModTimestamp()) {
debug(TALK, "modified: " + oldTopicNum);
if(!newTopics.contains(newTopic.getNum()))
newTopics.add(newTopic.getNum());
}
oldTopic.lock.writeLock().lock();
oldTopic.setLastModTimestamp(newTopic.getLastModTimestamp());
oldTopic.setLastPage(newTopic.getLastPage());
oldTopic.lock.writeLock().unlock();
} else {
// baleeted topic
if(!newTopics.contains(oldTopicNum))
newTopics.add(oldTopicNum);