; - } - A /** + * Get: Access the database and return the data string the * - * @paramURL $ * @returnString Data Strings the * @throwsException the */ the Public StaticString doget (string url)throwsexception{ theString result =NULL; -HttpClient =Httpclients.createdefault (); inHttpGet HttpGet =Newhttpget (URL); the //set the request and transmit timeout times the Httpget.setconfig (requestconfig); AboutCloseablehttpresponse Httpresp =Httpclient.e
threads are created in the code above, there can be only one thread executing concurrently. The semaphore method Semaphore (int permits) accepts an integer number that represents the number of licenses available. Semaphore (10) indicates that 10 threads are allowed to obtain a license, that is, the maximum number of concurrent is 10. Semaphore is also very simple to use, first the thread uses the semaphore acquire () method to obtain a license, and then call the release () method to return the
We can use the build tool plug-in provided by Tuscany to make the SDO definition a Java class that is actually needed to facilitate the work, following is a sample configuration using this plug-in:
src/main/resources/sdoModel.xsd org.sbbs
Driver == jdbc:oracle:thin:@192.168.10.105:1521== LFImportJava.io.InputStream;Importjava.sql.Connection;ImportJava.sql.DriverManager;Importjava.util.Properties; Public classJdbctools {//Properties File name Private StaticString defaultname = "Jdbc.properties"; /*** Get connection *@returnConnection *@throwsException*/ Public StaticConnection getconnection ()throwsexception{Connection Connection=getconnection (DefaultName); returnconnection; } /*** Get connection by properties file name
) {
String userName = ' 1 ' or ' 1 ' = ' 1 ';
String password = "123456";
UserName = Stringescapeutils.escapesql (userName);
Password = stringescapeutils.escapesql (password);
String sql = "Select COUNT (userId) from T_user WHERE username= '"
+ userName + "' and password = '" + Password + "'";
SYSTEM.OUT.PRINTLN (SQL);
}
In fact, Stringescapeutils not only provides the function of SQL special word escape processing, but also provides m
the relationship between packages and packages. Because the package contains classes, you can represent the relationship between packages and packages based on the relationships between the classes in those packages.Figure DAssociation (Association)A structured relationship between entities in a UML class diagram relationship indicates that the objects are interconnected. The arrows are optional and are us
relationship. 4. Interface and implementation Relationship dashed line with a hollow triangle Additions: The interfaces in Java are divided into three categories: 1. Common interface 2. Identity interface 3. Constant interface function: Improve code readability Abstract class and Interface: : Neither can be instantiated different: Methods in abstract classes can be abstract, can be specific The
be differentiated from the semantic level;
The aggregation relationship is also implemented using instance variables. There is no association or aggregation from the Java syntax.
Combinatorial (composition) relationship (composition): Also a special case of association, he embodies a kind of contains-a relationship, which is stronger than aggregation, also known as strong aggregation; he also embodies the relationship between the whole and the parts
Java exception architecture diagram and several interview questions, java architecture diagram questions
1. java exception Architecture
The pink ones are checked exceptions, which must be captured by the try {} catch Block or declared by the throws clause in the method sign
declared in the interface. In UML, the implementation relationship between a class and an interface is represented by a dashed line with a hollow triangle.
Public interface Vehicle
{public
void Move ();
}
Public class ship implements Vehicle
{public
void Move ()
{
...
}}
}
public class Car implements Vehicle
{public
void Move ()
{
phrase (verbs + nouns) converted to nouns, such as the increase in goods to have a commodity added class, registration of a user should have a registration class, etc.
(3) Boundary class: Boundary class is used to abstract the interaction object between external user and system, mainly including interface
interface and the database. The control class is usually a noun that is transformed by a verb-structure phrase (verbs + nouns), such as adding a commodity to a product, adding a class, registering a user registration class, etc.(3) Boundary class: The boundary class is used
escape processing, but also provides methods of escaping and restoring HTML, XML, JavaScript, Java special characters. If you don't mind introducing the Jakarta Commons lang package, we recommend that you use the Stringescapeutils tool class to do the work of special word escape processing.
Back to the top of the page
Method into the parameter detection
attributes, the attribute name is underlined. As shown in.
In addition, a class chart can represent the relationship between classes and between objects. The difference between the two is that the object name in the object graph is underlined.
2. Relationships in class diagrams
(1) Generalization: Generalization and Generalization
Generalization indicates the inheritance relationship between classes, the i
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.