Java³ÌÐòµÄÎÊÌâ
ÕâÊÇÒ»¶ÎÎҲο¼µÄJava³ÌÐò×ֶΣ¬ÒѾµ÷ÊÔ¿ÉÒÔͨEclipseÔËÐÐÁË£¬´úÂëÓе㿴²»¶®£¬ÄÄλ¸ßÊÖ¿ÉÒÔ°ïÎÒ×ö¸öÖÐÎÄ×¢ÊÍ£¿Ð»Ð»À²~~
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
public class IPBanner {
public static final String NETSTAT = "netstat -nt"; //$NON-NLS-1$
public static final String IP_INSERT = "iptables -I INPUT -i eth0 -j DROP -p tcp --dport 80 -s "; //$NON-NLS-1$
public static final String IP_DEL = "iptables -D INPUT -i eth0 -j DROP -p tcp --dport 80 -s "; //$NON-NLS-1$
public static final String HOST_IP = "192.168.16.243:80"; //$NON-NLS-1$
public static final long BAN_TIMEOUT = 30 * 60 * 1000L;
public static final long BAN_INTERVAL = 30 * 1000L;
public static final int CONCURRENT = 80;
public static final int SYN_CONCURRENT = 8;
public static final Map banMap = new HashMap();
public static void ban()throws Exception{
Set banList = dynamicBanIP();
System.out.println();
System.out.println("Time: " + new Date()); //$NON-NLS-1$
&n
Ïà¹ØÎĵµ£º
¸½Â¼A: Java±àÂë¹æ·¶
Ò»¡¢ JavaÃüÃûµÄÒ»°ãÐÔÖ¸µ¼
1. ÀàÃûÊ××ÖĸӦ¸Ã´óд¡£ÊôÐÔ£¨³ÉÔ±±äÁ¿£©¡¢·½·¨¡¢¶ÔÏó±äÁ¿ÒÔ¼°ËùÓбêʶ·û£¨ÈçÐÎʽ²Î
Êý¡¢Êµ¼Ê²ÎÊý¡¢¾Ö²¿±äÁ¿£©µÄÊ××ÖĸӦСд£¬ÆäÖаüº¬µÄËùÓе¥´Ê¶¼Ó¦½ô¿¿ÔÚÒ»Æ𣬶ø
ÇÒ´óдÖм䵥´ÊµÄÊ××Öĸ¡£
ÀýÈ磺ÀàÃû£ºThisIsAClassName ÊôÐÔ»ò·½·¨Ãû£ºthisIsMethodOrFieldName
......
¸Õ²ÅÔÚ×ö¸ö²âÊÔʱ ɾ³ýÎļþÀÏÊÇʧ°Ü...Ò»Ö±ÕÒ²»µ½ÔÒò.. file.delete();
×ÜÊÇ·µ»Øfalse.
ÔÚÍøÉÏÕÒÁË°ëÌì ¶¼ÕÒ²»µ½´íÔÚÄĶù..
if(file.exists() && file.canWrite())
file.delete();
ÕâÑù¶¼²»ÐС
ºóÀ´Í»È»Í»È»Ïëµ½´íÔÚÄĶùÁË..
¾ÍÊÇÔÚдÍêÎļþºóûÓÐclose
out.write(b);
out.flush();
out.close();
......
Java MailÎÞ·¨½âÎö´ø·ÖºÅµÄÊÕ¼þÈËÁбíµÄÎÊÌâ
½ñÌìͬÊÂÅöµ½Ò»¸öÎÊÌ⣬ʹÓÃJAVA MAILÊÕÈ¡Óʼþʱ£¬Èç¹ûÊÕ¼þÈËÊǸöÁÐ±í£¬ÇÒÊÕ¼þÈËÁбíÊÇÒԷֺŽøÐзָîµÄ£¬ÔòJAVA MAIL¾Í»á³öÏÖÒì³££¬²»ÄÜÕý³£½âÎö£¬³é¿Õ¿´ÁËÒ»ÑÛ£¬×Ô¼ºÐ´Á˸ö¼òµ¥demo£¬ºÜ¼òµ¥£¬ÀýÈ磺
@Test
public void te ......
¶þ¡¢JavaÀ¬»ø»ØÊÕ
1. JVMÔËÐл·¾³ÖÐÀ¬»ø¶ÔÏóµÄ¶¨Òå
Ò»¸ö¶ÔÏó´´½¨ºó±»·ÅÖÃÔÚJVMµÄ¶ÑÄÚ´æÖУ¬µ±ÓÀÔ¶²»ÔÙÒýÓÃÕâ¸ö¶ÔÏóʱ£¬Ëü½«±»JVMÔÚ¶ÑÄÚ´æÖлØÊÕ¡£»ò µ±¶ÔÏóÔÚJVMÔËÐпռäÖÐÎÞ·¨Í¨¹ý¸ù¼¯ºÏ(root set)µ½´ïʱ£¬Õâ¸ö¶ÔÏó¾Í±»³ÆΪÀ¬»ø¶ÔÏó¡£
2. ¶ÑÄÚ´æ
* ÔÚJVMÆô¶¯Ê±±»´´½¨£»¶ÑÄÚ´æÖÐËù´æ´¢µ ......
Ê×ÏÈboolean²»ÄܸúÆäËûÀàÐÍת»»¡£
1.¸³ÖµÊ±£º
ÕûÊýĬÈϵÄÊÇint ¸¡µãĬÈÏÊÇdouble£¬¼´ÕûÐ͵ȺÅÓÒ²àÈ«²¿×Ô¶¯×ª»¯Îªint£¬¸¡µãÐ͵ȺÅÓÒ²à×Ô¶¯×ª»»Îªdouble¡£µ±´óÈÝÁ¿µÄÊý¾ÝÀàÐ͸³Öµ¸øСÈÝÁ¿µÄÊý¾ÝÀàÐÍʱ ÐèҪǿÖÆÀàÐÍת»»µ«ÊÇÓÐ ......