*/
public Post getPost(String postId) {
synchronized (posts) {
- return posts.get(postId);
+ Post post = posts.get(postId);
+ if (post == null) {
+ post = new Post(postId);
+ posts.put(postId, post);
+ }
+ return post;
}
}
*/
public Reply getReply(String replyId) {
synchronized (replies) {
- return replies.get(replyId);
+ Reply reply = replies.get(replyId);
+ if (reply == null) {
+ reply = new Reply(replyId);
+ replies.put(replyId, reply);
+ }
+ return reply;
}
}