1.apache-maven-3.2.1-bin.zipand apache-maven-3.2.1-src.zip files.
2. Blocking queue:
AddIf the queue is full, an iiiegaislabeepeplian exception is thrown.
RemoveRemoves and returns the element in the queue header. If the queue is empty, a nosuchelementexception exception is thrown.
ElementReturns the element in the queue header. If the queue is empty, a nosuchelementexception exception is thrown.
OfferAdd an element and return true. If the queue is full, return false.
PollRemoves and returns the element in the queue header. If the queue is empty, null is returned.
PeekReturns the element in the queue header. If the queue is empty, null is returned.
PutAdd an element. If the queue is full, it is blocked.
TakeRemove and return the elements in the queue header. If the queue is empty, it is blocked.
3. Execute the JAR file containing the main method (main), Java-jar **. Jar
4. getbyte generally uses getbyte ("UTF-8") to prevent Chinese garbled characters when obtaining string binary code.
5. When "|" is used for cutting, escape is required.
6. Use tomcat to start the service. You can view Tomcat logs in the logs directory of Tomcat.
7. cache update policy: query in the cache. If the cache does not exist, query in the database. If there is any in the database, get the data and return it. At the same time, update the cache.
8. log records are very important. Place the log4j. properties file outside the jar package. To ensure that the configuration file is loaded, run the following code:
String uri = ConfigTool.getConfigUri("log4j.properties");if(null != uri){ PropertyConfigurator.configure(uri);}public static String getConfigUri(String fileName) { String r = null; if((new File(fileName)).exists()){ return fileName; } String userDir = System.getProperty("user.dir"); File confInDir = new File(userDir + File.separator + fileName); URL confInClassPath = ConfigTool.class.getResource("/" + fileName); if (null != confInClassPath && confInDir.exists()) { r = confInClassPath.toString(); } else if (confInDir.exists()) { r = confInDir.getAbsolutePath(); } else { URL uri = ConfigTool.class.getResource(fileName); if(null != uri){ r = uri.toString(); } } return r; }
9. system. getproperty ("user. dir"); // directory of the project where the current program is located
10. Put the configuration file out of the jar package to facilitate modification of the configuration file. Load files in 8th ways.
11. In a scheduled task, when using connections in the connection pool, you should consider using the singleton mode. Do not retrieve new connections from the connection pool each time.
Weekly log on March 31