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

Java×Ô¶¨Òå¶àÏ̷߳þÎñÆ÷

// multi.MultiServer.java
package multi;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
public class MultiServer {
private int port = 8000;
private int backlog = 42;
private ServerSocket server_socket;
private ThreadPool threadPool;
private final int POOL_SIZE = 7;

public MultiServer()throws IOException{
server_socket = new ServerSocket();
server_socket.setReuseAddress(true);
server_socket.bind(new InetSocketAddress(port),backlog);
int system_cpu_total = Runtime.getRuntime().availableProcessors();
threadPool = new ThreadPool(POOL_SIZE * system_cpu_total);
System.out.println("--- server started! ---");
}
public void service(){
while(true){
try{
Socket socket = server_socket.accept();
threadPool.execute(new WorkHandler(socket));
} catch(Exception e){
e.printStackTrace();
}
}
}
public static void main(String[] args)throws Exception {
MultiServer server = new MultiServer();
server.service();
}
}
// multi.ThreadPool.java
package multi;
import java.util.LinkedList;
public class ThreadPool extends ThreadGroup{
private static int threadPoolId;
private boolean isClosed = false;
private LinkedList<Runnable> workQueue;

public ThreadPool(int poolSize){
super("ThreadPool-" + (threadPoolId++));
setDaemon(true);
workQueue = new LinkedList<Runnable>();
for(int i=0;i<poolSize;i++){
new WorkThread(this,i).start(); // Æô¶¯¹¤×÷ÕßÏß³Ì
}
}

public synchronized void execute(Runnable task){
if(isClosed){
throw new IllegalStateException("The " + getName()
+ " has closed!");
}
if(task != null){
workQueue.add(task);
// Ò»´ÎÖ»ÓÐÒ»¸öÏß³ÌÈ¡ÈÎÎñ[getTask() ±» synchronized ÐÞÊÎ]
// ËùÓд˴¦Ã»ÓÐʹÓÃnotifyAll();


Ïà¹ØÎĵµ£º

java Ï̵߳÷ÓÃHttpClientµÄʵÁ¦

×¢Òâ,Óõ½ÁËÄÚ²¿Àà:
new Thread
   (
     new Runnable()
     {
      public void run()
      {
       try
    &n ......

Flex+LCDS+Java ʵ¼ù£¨Ò»£© ÓÎÏ·´óµØÍ¼±³¾°ÖÆ×÷

ǰÑÔ£º
±¾ÏîÄ¿Ö÷ÒªÊÇͨ¹ý°ÑµØÍ¼ÇÐÆ¬Ç¶Èëswf£¬°ÑÇÐÆ¬×ø±êÓÃJavaÊý¾Ý´ò°ü£¬È»ºó ÔÚFlexÏîÄ¿ÄÚͨ¹ýJava¶ÁÈ¡´ò°üÊý¾Ý£¬Í¨Ñ¶¸øFlex£¬×îºó°ÑswfÄÚµÄͼƬ°²·ÅÔÚ¶ÔӦλÖÃÀ´Êµ´óµØÍ¼ ²ð·Ö->´ò°ü->ÔÙÏֵĹý³Ì¡£
1.  swfͼƬ´ò°ü´úÂë BitMapClass.as
package
{
import flash.display.Sprite;

public class BitM ......

Java¼¯ºÏ¿ò¼Üͼ


Java¼¯ºÏ¿ò¼Üͼ
¡¡¡¡¼¯ºÏ½Ó¿Ú£º6¸ö½Ó¿Ú£¨¶ÌÐéÏß±íʾ£©£¬±íʾ²»Í¬¼¯ºÏÀàÐÍ£¬ÊǼ¯ºÏ¿ò¼ÜµÄ»ù´¡¡£
¡¡¡¡³éÏóÀࣺ5¸ö³éÏóÀࣨ³¤ÐéÏß±íʾ£©£¬¶Ô¼¯ºÏ½Ó¿ÚµÄ²¿·ÖʵÏÖ¡£¿ÉÀ©Õ¹Îª×Ô¶¨Ò弯ºÏÀà¡£
¡¡¡¡ÊµÏÖÀࣺ8¸öʵÏÖÀࣨʵÏß±íʾ£©£¬¶Ô½Ó¿ÚµÄ¾ßÌåʵÏÖ¡£
¡¡¡¡Ôںܴó³Ì¶ÈÉÏ£¬Ò»µ©ÄúÀí½âÁ˽ӿڣ¬Äú¾ÍÀí½âÁË¿ò¼Ü¡£ËäÈ»Äú×ÜÒª´´½ ......

ɵB×Ô¼º¿´µÄjava±Ê¼Ç£ºÁ¬½ÓMYSQL

  ¸ÄÒ»¸öÕâÑùµÄÌâÄ¿Õýʽ¸æËßÄ㣬ÎÒÖÕÓÚ¶¯ÊּǼһЩjavaµÄ±Ê¼ÇÁË¡£ÊµÔںܾÃûÓÐдjavaÁË¡£¹þ¹þ£¬²»ºÃÒâ˼£¬ÎªÁËflash ºǫ́ÓиöÖ§³Ö£¬java Õⲿ·Ö»¹ÊÇҪѧһµã£¬µ«²»ÊǺÜÖØµãѧ¡£Õⲿ·Ö¶«Î÷£¬ÎÒ²»ÊìϤ£¬Ò²ÔÚÂýÂý¼Ç¼¡£×Ô¼º¿´µÄ±Ê¼Ç£¬ËùÒÔÒªÊÇÄã²»ÊÇɵB£¬×îºÃ²»Òª¿´¡£
   ÔÚ½ñÍíÁ·Ï°µÄʱºò£¬³¢ÊÔÈ¥Á¬½Ó¿É°®µÄ ......

ÈçºÎÓ¦ÓÃJavaµÄBigDecimalÀà

±¾ÎĽéÉÜJavaµÄBigDecimalÀàµÄÓ¦Óá£JavaÔÚjava.math°üÖÐÌṩµÄAPIÀàBigDecimal£¬ÓÃÀ´¶Ô³¬¹ý16λÓÐЧλµÄÊý½øÐо«È·µÄÔËËã¡£
BigDecimalÀà
Ë«¾«¶È¸¡µãÐͱäÁ¿double¿ÉÒÔ´¦Àí16λÓÐЧÊý¡£ÔÚʵ¼ÊÓ¦ÓÃÖУ¬ÐèÒª¶Ô¸ü´ó»òÕ߸üСµÄÊý½øÐÐÔËËãºÍ´¦Àí¡£JavaÔÚjava.math°üÖÐÌṩµÄAPIÀàBigDecimal£¬ÓÃÀ´¶Ô³¬¹ý16λÓÐЧλµÄÊý½øÐо«È· ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ