Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

java²¢·¢±à³Ìʵ¼ù ±Ê¼Ç£¨1£©

Ḭ̈߳²È« ʲôÊÇḬ̈߳²È«(thread-safe)£¿ Ò»¸öÀ࣬Èç¹ûÄܹ»ÔÚ¶àÏ̲߳¢·¢·ÃÎʵĻ·¾³Ï£¨²»¹ÜÏ̷߳ÃÎʵÄ˳Ðò£©ÕýÈ·±íÏÖ×Ô¼ºµÄÐÐΪ£¬²¢ÇÒÎÞÐèÍⲿµ÷ÓÃÌí¼ÓÈκÎͬ²½Ö®ÀàµÄ²Ù×÷£¬Õâ¸öÀà¾ÍÊÇḬ̈߳²È«µÄ¡£
Õâ¸öÕýÈ·ÐÔ¿ÉÒÔÕâôÀí½â£¬¾ÍÊÇ˵¶àÏ̷߳ÃÎʵĽá¹û²»»á²»Í¬ÓÚµ¥Ï̵߳ķÃÎÊ¡£
Ḭ̈߳²È«µÄÀ಻ÐèÒªÍⲿµ÷ÓÃÌṩÈκθ½¼ÓµÄͬ²½¡£ ÎÞ״̬(stateless)µÄÀàÓÀÔ¶ÊÇḬ̈߳²È«µÄ¡£
ʲôÊÇÎÞ״̬µÄÀࣿûÓÐʵÀý±äÁ¿(field)£¬Ò²Ã»ÓÐÒýÓÃÆäËüÀàµÄfield¡£ Ô­×ÓÐÔ A race condition occurs when the correctness of a computation depends on the relative timing or interleaving of multiple threads by the runtime; in other words, when getting the right answer relies on lucky timing. ×î³£¼ûµÄrace conditionÊÇcheck-and-act¡£Òª·ÀÖ¹ÕâÖÖrace condition£¬ÎÒÃÇÐèÒªÔ­×ÓÐԵIJÙ×÷¡£Ê²Ã´ÊÇÔ­×ÓÐÔÄØ£¬¾ÍÊÇ˵£¬ÄãÕâ¸ö²Ù×÷ÔÚÖ´ÐеĹý³ÌÖУ¬¶ÔÓÚÄã²Ù×÷µÄ״̬ÉÏÆäËüµÄ²Ù×÷£¨°üÀ¨Äã×Ô¼º£©ÒªÃ´È«¶¼Ö´ÐÐÍêÁË£¬ÒªÃ´»¹Ã»¿ªÊ¼¡£
Ïë˵¾äͨ˳µÄÖйú»°ÔõôÕâôÄѰ¡£¬»¹ÊǸø³öÔ­Îİɣº Operations A and B are atomic with respect to each other if, from the perspective of a thread executing A, when another thread executes B, either all of B has executed or none of it has. An atomic operation is one that is atomic with respect to all operations, including itself, that operate on the same state. À´¸öÀý×Ó @NotThreadSafe
public class UnsafeCountingFactorizer implements Servlet {
private long count = 0;
public long getCount() { return count; }
public void service(ServletRequest req, ServletResponse resp) {
BigInteger i = extractfromRequest(req);
BigInteger[] factors = factor(i);
++count;
encodeIntoResponse(resp, factors);
}
}
@ThreadSafe
public class CountingFactorizer implements Servlet {
private final AtomicLong count = new AtomicLong(0);
public long getCount() { return count.get(); }
public void service(ServletRequest req, ServletResponse resp) {
BigInteger i = extractfromRequest(req);
BigInteger[] factors = factor(i);
count.incrementAndGet();


Ïà¹ØÎĵµ£º

java´íÌ⼯


Õý¶à±ßÐÎÖÐ×µÄ¶Ô½ÇÏß¾ÍÊÇÖ÷¶Ô½ÇÏߣ¬ÆäÓàµÄ¶Ô½ÇÏß¾ÍÊǸ±¶Ô½ÇÏß
lang ÊÇ language£¨ÓïÑÔ£© µÄ¼òд
ÊÇjavaÖг£Ó÷½·¨×î¶àµÄ°ü
°üº¬³£ÓÃÀà
 
 
 
Runnable½Ó¿Ú£¬Ö»ÓÐÒ»¸ö·½·¨run()
exit(int status)
          ÖÕÖ¹µ±Ç°ÕýÔÚÔËÐÐµÄ Jav ......

ÔÚEclipseÖÐÓÃJavaʵÏÖ°ÙÁ鱨±í(BIRT)µÄʼþ´¦Àí

8. µ±ÏµÍ³´¦ÀíÍê³Éºó£¬±¨±í±»ÏÔʾ³öÀ´¡£ÕâÊÇÒ»·ÝÉÌÆ·ÏúÊÛ±¨¸æ£¬ÏÔʾµÄÊÇÿÀàÉÌÆ·µÄ¼¾¶ÈÏúÊÛ¶îÒÔ¼°ÀÛ¼ÆÇé¿ö¡£½ÓÏÂÀ´£¬ÎÒÃdz¢ÊÔÓà Java
´´½¨Ò»¸öʼþÏìÓ¦´¦ÀíÀ࣬°Ñÿ¼¾¶ÈÏúÊÛ¶îÔÚ10ÍòÃÀÔªÒÔÉϵÄÊý¾ÝÓúìÉ«±êʾ³öÀ´¡£
´´½¨ Java Àà
    °´ÕÕÈçϲ½Ö裬Óà Java ´´½¨°ÙÁ鱨±í£¨BIRT£©µÄʼþÏìÓ¦´¦Àí³ÌÐò¡£
......

Scooter Framework; Java¤ËCRUD¤È¥·¥ó¥×¥ë¤µ¤òÌṩ

ÏÂÎÄÊÇÈÕ±¾ÈË·­ÒëµÄÀÏÍâµÄÎÄÕ£¬ÈÕ±¾ÓÐÒ»°ïÈËÔÚ³´Ruby£¬ºÃÏñÊÇÈÕ±¾ÈË·¢Ã÷µÄ£¬Èç¹û¹Ø×¢µÄÈ˶àÁËÒ²ÓпÉÄÜÔÚÒ»¶¨µÄ·¶Î§ÄÚÁ÷ÐÐÆðÀ´¡£
´ËÎĽéÉÜÁËScooter framework¿ò¼Ü£¬ÊÇ»ùÓÚRuby on Rails ¹¹ÖþµÄ£¬ÊÇÒ»¸öSSH¿ª·¢¼¯³ÉµÄÌæ´úÆ·£¬Óõ½ÁËJAVAµÄһЩµ×²ã¼¼Êõ£¬ÓкܶàеĸÅÄ1.0°æ±¾Ô¤¼Æ½ñÄê6£¬7Ô·ݷ¢²¼¡£Ã²Ëƹ¦ÄܺÜÇ¿´ó£¬¸ÐÐ ......

Java SWT ´°¿Ú¾ÓÖÐ¶ÔÆë

public static void CentreWnd(Shell shell){
int width = shell.getMonitor().getClientArea().width;
int height = shell.getMonitor().getClientArea().height;
int x = shell.getSize().x;
int y = shell.getSize().y;
if (x > width) {
shell.getSize().x = width;
}
if (y > height) ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ