高并发小设计思维
今天看sun的HttpMessages.java文件,虽然文件很小,但是对我的启发很大。
前面定义了大量的HTTP常量:
Java代码
public static String getMessage(int status) { // Return the status message for the most frequently used status // codes directly, without any lookup switch (status) { case 200: return STATUS_200; case 302: return STATUS_302; case 400: return STATUS_400; case 404: return STATUS_404; } return httpStatusCodeMappings.get("sc."+ status); } public static String getMessage(int status) { // Return the status message for the most frequently used status // codes directly, without any lookup switch (status) { case 200: return STATUS_200; case 302: return STATUS_302; case 400: return STATUS_400; case 404: return STATUS_404;} return httpStatusCodeMappings.get("sc."+ status); }