Discover java coding best practices, include the articles, news, trends, analysis and practical advice about java coding best practices on alibabacloud.com
factor, ebay refers to the existing application porting and training developers in the implementation of YA Xu carefully considered.?? The characteristics of the SOA platform for a basic large-scale application mentioned above, and for a more complete SOA platform, the author believes that there are also the following points:
Support cluster environment: Software load Balancing, service interface or method level routing strategy, etc.
Perfect service governance: including dependenc
[Java] itoo project practices: optimized collection of millions of data queries and itoo data queries
1. To optimize the query, you should consider creating an index on the columns involved in where and order.
2. Try to avoid null value determination on the field in the where clause, for example, select id from t wherenum is null.
You can set the default value 0 on num to make sure that the num column in t
String j = stringutils.join (new string[] {"A", "B", "C"}, ","); System.out.println (j); // A, B, C 8. Converting an array list to arrays String[] Stringarray = {"A", "B", "C", "D", "E" }; ArrayListNew arraylist(arrays.aslist (Stringarray)); New string[arraylist.size ()]; Arraylist.toarray (Stringarr); for (String S:stringarr) System.out.println (s); 9. Converting an array to set (set) New Hashset(Arrays.aslist (Stringarray)); SYSTEM.
encoding to store it. This will take into account the importance of storage space or the efficiency of coding (three common).
1. ASCII code
We all know that ASCII code, a total of 128, with a byte of low 7-bit, 0-31 is the control character Furu space, enter, delete 32-126 is the print characters, can be entered through the keyboard and can be displayed.
Figure 1-ascii Code
2, UTF-16
Speaking of UTF must mention Unicode,iso trying to create a new hy
(); } The above task contains an application for an external class instance, which will cause the reference to not be reclaimed by the GC immediately. Because the timer will remain TimerTask is released after a specified time. Therefore, the external class instance corresponding to the task will be reclaimed after 5 minutes. The correct wording: Timertasktask=newjob (this); timer.schedule (task,300000l); Try{dosomething (); }finally {task.cancel ();} staticclassJobextendsTimerTask{ privateMyCla
list loaded into memory, accidentally checked 100w data, and check more frequently, the memory burst. There is this risk of changing the composition page query.Eight: Consider avoiding long connections or long transactions inside a transaction, which can affect performance if a large number of this situation takes up a data connection. Some unnecessary logic can be placed outside of the transaction execution.IX: A normal indexb Uniqueness index with unique parameter, primary key.C Single-colum
class does not lineThe order of the process to obtain the license to do any guarantee. In particular, intrusion is allowed, meaning that it can be in front of the waiting threadacquire()assigns a license to the calling thread, which logically means that the new thread puts itself in the waiting thread queue's head. When fair is set to true, the semaphore is guaranteed for any 获取 thread that invokes the method, asThe order in which they call these methods (i.e., FIFO) to select a thread and obta
of the busy cycleA looping statement designed to consume time22. The method that lets one thread wait for another thread to dieJoin ()23. The thread method that lets you sleepSleep ()24. Write an application called Intsleep, which creates a background thread, continuously prints out Hello, and then sleeps 100ms. After sleeping 2s, the default main thread should interrupt the background thread, which jumps out of the loop after printing out the interruptedpublic class Intsleep {public static voi
Learn Java for a few months, has been to public,private,protected,static,final keyword and with each other not too concerned about, today read the "Java Security coding standards" only to find the severity of the problem.Code that does not conform to the rule:A data member of the underlying data type of public (common). Should be changed into private form.Public
Refer to Sun's Java coding specification, semi-translation semi-comprehension.
Use blank lines to split blocks of code and add comments to code blocks;
A file a class (or interface) that places a private class behind a common class that references that class;
Source file composition: The declaration of a file comment, Package/import, class, or interface;
Environment Java Environment JDK1.8 installed mysql-5.6.38-winx64 idea2016 (64)The problem is this: Idea debugging Eclips project into the database and changing question marksFirst of all, Eclips and release of the project is not a problem, the first thought is the coding problem, so check the project and database code, but see that the code is UTF-8, the database is viewed through (navicat)But there are ar
xml| Coding | solve | Problems recently encountered a project, the need to save the declaration file in XML format, coding problems really let me a headache for a while. Now all unified into UTF-8 code. Specific operations in various languages
Here, I use the DOM for XML parsing, which should be simple.
1 customers first use VB to edit the form, generate a Apply.xml file.
In VB, use MSXML 4.0. If you don't
Start from difficulty 1:1, Remove specified Elem from unsorted array:2 pointers, one was to iterate all the elements in the array, the. Increase if current value was not equal to specified element.2, Remove duplicates from sorted Array:still 2 pointers, compare current value with Previous.3, Remove 3rd duplicate from sorted Array:on 2, with another var to store the appearance number.4, Remove duplites from sorted linked List:prev Curr, then pay attention to NULL head input.[
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.