**/ }The above is the setter method of control, in fact, through the use of encapsulation we can also be able to control the export of objects. For example gender we are generally in the database is 1, 0 ways to store, but at the front desk we can not show 1, 0, here we just need to do some conversion in the Getter () method.Public String Getsexname () { if ("0". Equals (Sex)) { sexname = "female"; } else if ("1". Equals (Sex)) { sexname = "male";
Using Java's own class java.util.zip for file/directory compression, there is a lack of support for Chinese name/directory naming, if there is a Chinese name, then packaging will fail. I after a period of exploration and practice, found in the General Ant.jar Class Library also has a zip class, import org.apache.tools.zip.*, can solve the problem that does not support the Chinese file directory, at the same time, ant access to more ways, The general application server has this
The key component of the spring framework is the aspect-oriented programming (AOP) framework. Aspect-oriented programming not only breaks down the logic of the program into different parts called the so-called worry. The functionality of an application that spans multiple points is known as crosscutting concerns and these crosscutting concerns are distinguished from the business logic concepts of the application. There are a variety of common good examples
time, that is, if notify ()/ Notifyall () is followed by code, and will continue, knowing that the current thread is finished before releasing the synchronized lock object;
3.notify ()/notifyall () after execution, if the right has a sleep () method, will cause the current thread into the blocking state, but the synchronization object lock is not released, still keep their own, then will continue to execute this thread, next to the same 2;
4.wait ()/notify ()/nitifyall () the communication or
Append: Represents the value corresponding to the key and adds the input at the end
Delete: Remove Key's corresponding value
More protocols can be consulted: the Protocol.txt in the memcached package
Specific examples are as follows:
It is important to note that if you specify a character length of 5 at set time and the input exceeds this length, you will be given an error: Client_error bad data chunk
the bandwidth, still has a large amount of data waiting for the network to read and write;
Another situation may be network idle, but due to problems such as routing, the package does not arrive properly.
Another common scenario in which wait on condition occurs is when the thread is in sleep, waiting for the time of sleep to be awakened.
Blocked: Thread blocking, refers to the current thread execution process, the requi
Common examples of Java multithreading
Author: narcisoforher
Reprint: Click to read the full text view
I. Related knowledge:
Java multithreaded programming to the knowledge:
(i) operation of the same quantity
(ii) operation of the same object
(iii) The callback method uses
(iv) Thread synchronization, deadlock problem
(v) Thread communication
Wait a minute
Two
the two sentences are printed, not the finish loop. However, the value of the stop can be found to be true.
The blogger uses tools to restore the program to assembly code
Here only a part of the assembly code, the red part of the loop, you can clearly see only in the 0x0193bf9d to do the stop verification, and the red part does not take the value of the stop, so the infinite loop.
This is the result of JVM optimizations. How to avoid it? As with the command rearrangement, use the volatile ke
consuming, the execution method of the job should be synchronously processed.2: If the job calls other service methods, the methods provided by other services are also guaranteed to be published as thread-safe methods.Let's take a look at a few ways to implement timed tasks:1:java provided by the timerPackage Com.home.thread.thread10;import java.util.date;import java.util.timer;/** * @author Gaoxu * Practice a genuine knowledge! */public class Timerm
This article mainly introduces the Java use Listener to achieve a statistical site online number of examples, with a certain reference value, there is a need for friends to understand.
(1) Create a listener implementation class
To roughly count the number of people online on a website, first, you can listen by Servletcontextlistener, and when the Web application context starts, add a list to the ServletCo
", Removeset);Clone a Retainset, the contents and set are identicalHashSet Retainset = (HashSet) set.clone ();Preserve "retainset, elements belonging to Otherset"Retainset.retainall (Otherset);Print RetainsetSystem.out.printf ("Retainset:%s\n", Retainset);Traverse HashSetfor (Iterator Iterator = Set.iterator ();Iterator.hasnext (); )System.out.printf ("Iterator:%s\n", Iterator.next ());Empty HashSetSet.clear ();Whether the output HashSet is emptySystem.out.printf ("%s\n", Set.isempty ()? " Set i
); Newthread.start (); System.out.println ("The message has been send!"); } Public Static voidMain (String args[]) {Local local=NewLocal ("Hello",NewRemote ()); Local.sendmessage (); }} PackageCom.sunchao.callback;/*** The remote class which used by to handle * The message which send from the local class *@authorAdministrator **/ Public classRemote {/*** The method used to handle the message *@paramMSG The message send from the callback class *@paramCallBack the CallBack class*
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.