왕 홍 생방송
                                            
 116347 단어  자바
                    
package happy;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooDefs.Ids;
import org.apache.zookeeper.ZooKeeper;
public class HappyRoom {
    //zookeeper    
    private static String connectServerList = "192.168.220.130:2181,192.168.220.131:2181,192.168.220.132:2181";
    //      
    private static int sessionTimeout = 20000;
    //zookeeper   
    public static ZooKeeper zk = null;
    //        
    private static final String anchor = "/anchor";
    /**
     *       
     */
    public void singIn(String BeautyAnchorName) throws Exception{
     ZooKeeper  happyOnline = new ZooKeeper(connectServerList, sessionTimeout, null);
     //  
        happyOnline.create(anchor +"/BeautyAnchor", BeautyAnchorName.getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL_SEQUENTIAL);
        System.out.println("    ------>"+BeautyAnchorName +");
    }
    /**
     *   
     */
    public void liveBroadcast(String BeautyAnchorName) throws InterruptedException{
        System.out.println("    ------->"+BeautyAnchorName+"+"    LOL     5 ....");
        Thread.sleep(Long.MAX_VALUE);
    }
    /**
     *     
     */
    public static void main(String[] args) throws Exception{
        HappyRoom happyRoom = new HappyRoom();
        happyRoom.singIn(args[0]);
        happyRoom.liveBroadcast(args[0]);
    }
}
 
 
 
 
 
 
 
package happy;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Random;
/**
 *       VIP  
 */
public class Player {
    /**
     *
     *
     *        
     * ゛    、    ↘
     *       
     *
     *      、    
     *        
     *     Gay     ?
     *
     *         
     *
     *    
     *
     *      △
     *
     *     @
     *
     *        
     *
     *  ,    ,     
     *
     *             
     */
    volatile List<String> BeautyAnchor = null;
    ArrayList<String> VIP = new ArrayList<String>();
    //zookeeper    
    private static String connectServerList = "192.168.220.130:2181,192.168.220.131:2181,192.168.220.132:2181";
    //      
    private static int sessionTimeout = 20000;
    //zookeeper   
    public static ZooKeeper zk = null;
    //        
    private static final String anchor = "/anchor";
    public Player(){
        VIP.add("゛    、    ↘");
        VIP.add("      ");
        VIP.add("   、    ");
        VIP.add("      ");
        VIP.add("   Gay    ?");
        VIP.add("        ");
        VIP.add("   ");
        VIP.add("     △");
        VIP.add("   @");
        VIP.add("       ");
        VIP.add(" ,    ,     ");
        VIP.add("            ");
    }
    /**
     *         
     */
    public void viewBeautyAnchor() throws Exception{
        zk = new ZooKeeper(connectServerList, sessionTimeout, new Watcher() {
            public void process(WatchedEvent watchedEvent) {
                try {
                    refresh();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
        refresh();
    }
    /**
     * VIP      
     */
    public void VIPReward(){
        Random random = new Random();
        int n = random.nextInt(VIP.size());
        String VIPName = VIP.get(n);
        int m = random.nextInt(BeautyAnchor.size());
        String BeautyAnchorName = BeautyAnchor.get(m);
        System.out.println("VIP  -->    "+VIPName+" ======>     -->  "+BeautyAnchorName+"  --->      ,    ,    ");
    }
    /**
     *           
     */
    public void refresh() throws Exception{
        ArrayList<String> onlineBeautyAnchor = new ArrayList<String>();
        List<String> AnchorList = zk.getChildren(anchor, true);
        for (String Anchor: AnchorList ) {
            byte[] BeautyAnchor = zk.getData(anchor + "/" + Anchor, false, null);
            String BeautyAnchorName = new String(BeautyAnchor,"GBK");
            onlineBeautyAnchor.add(BeautyAnchorName);
            System.out.println(""+BeautyAnchorName);
        }
        BeautyAnchor = onlineBeautyAnchor;
        System.out.println("=    !i===    !i======    !i==========    !i====    !i==");
    }
    public static void main(String[] args) throws Exception {
        Player player = new Player();
        player.viewBeautyAnchor();
        player.VIPReward();
        Thread.sleep(Long.MAX_VALUE);
    }
}
 
       :
D:\>java -jar BeautyAnchor.jar    
2019-07-30 00:05:48,760 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:zookeeper.version=3.4.8--1, built on 02/06/2016 03:18 GMT
2019-07-30 00:05:48,760 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:host.name=DESKTOP-RALNSM7
2019-07-30 00:05:48,760 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.version=1.8.0_111
2019-07-30 00:05:48,761 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.vendor=Oracle Corporation
2019-07-30 00:05:48,761 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.home=D:\JAVA\jre
2019-07-30 00:05:48,761 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.class.path=BeautyAnchor.jar
2019-07-30 00:05:48,761 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.library.path=D:\JAVA\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;D:\JAVA\bin;D:\JAVA\jre\binC:\ProgramData\Oracle\Java\javapath;D:\Hadoop_2.7.2dev\hadoop-2.7.2\bin;D:\Hadoop_2.7.2dev\hadoop-2.7.2\sbin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\devSoftware\python27;D:\devSoftware\python36\;D:\devSoftware\bin;D:\MAVEN\apache-maven-3.5.0\bin;D:\devSoftware\Scripts\;D:\devSoftware\;D:\devSoftware\python36\Scripts\;D:\osSoftware\;.
2019-07-30 00:05:48,761 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.io.tmpdir=C:\Users\lsh\AppData\Local\Temp\
2019-07-30 00:05:48,761 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.compiler=<NA>
2019-07-30 00:05:48,762 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.name=Windows 10
2019-07-30 00:05:48,762 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.arch=amd64
2019-07-30 00:05:48,762 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.version=10.0
2019-07-30 00:05:48,762 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.name=lsh
2019-07-30 00:05:48,762 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.home=C:\Users\lsh
2019-07-30 00:05:48,762 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.dir=D:\
2019-07-30 00:05:48,763 INFO [org.apache.zookeeper.ZooKeeper] - Initiating client connection, connectString=192.168.220.130:2181,192.168.220.131:2181,192.168.220.132:2181 sessionTimeout=20000 watcher=null
2019-07-30 00:05:48,865 INFO [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server 192.168.220.130/192.168.220.130:2181. Will not attempt to authenticate using SASL (unknown error)
2019-07-30 00:05:48,868 INFO [org.apache.zookeeper.ClientCnxn] - Socket connection established to 192.168.220.130/192.168.220.130:2181, initiating session
2019-07-30 00:05:48,880 INFO [org.apache.zookeeper.ClientCnxn] - Session establishment complete on server 192.168.220.130/192.168.220.130:2181, sessionid = 0x16b29c2ee08000b, negotiated timeout = 20000
2019-07-30 00:05:48,882 ERROR [org.apache.zookeeper.ClientCnxn] - Error while calling watcher
java.lang.NullPointerException
at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:530)
at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:505)
    ------>   <-----    ,    、    ...       ......
    ------->   <--------    LOL     5 ....
 
 
 
 
 
D:\>java -jar BeautyAnchor.jar          
2019-07-30 00:08:52,252 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:zookeeper.version=3.4.8--1, built on 02/06/2016 03:18 GMT
2019-07-30 00:08:52,253 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:host.name=DESKTOP-RALNSM7
2019-07-30 00:08:52,253 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.version=1.8.0_111
2019-07-30 00:08:52,253 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.vendor=Oracle Corporation
2019-07-30 00:08:52,253 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.home=D:\JAVA\jre
2019-07-30 00:08:52,253 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.class.path=BeautyAnchor.jar
2019-07-30 00:08:52,253 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.library.path=D:\JAVA\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;D:\JAVA\bin;D:\JAVA\jre\binC:\ProgramData\Oracle\Java\javapath;D:\Hadoop_2.7.2dev\hadoop-2.7.2\bin;D:\Hadoop_2.7.2dev\hadoop-2.7.2\sbin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\devSoftware\python27;D:\devSoftware\python36\;D:\devSoftware\bin;D:\MAVEN\apache-maven-3.5.0\bin;D:\devSoftware\Scripts\;D:\devSoftware\;D:\devSoftware\python36\Scripts\;D:\osSoftware\;.
2019-07-30 00:08:52,254 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.io.tmpdir=C:\Users\lsh\AppData\Local\Temp\
2019-07-30 00:08:52,254 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.compiler=<NA>
2019-07-30 00:08:52,254 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.name=Windows 10
2019-07-30 00:08:52,254 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.arch=amd64
2019-07-30 00:08:52,254 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.version=10.0
2019-07-30 00:08:52,254 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.name=lsh
2019-07-30 00:08:52,255 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.home=C:\Users\lsh
2019-07-30 00:08:52,255 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.dir=D:\
2019-07-30 00:08:52,255 INFO [org.apache.zookeeper.ZooKeeper] - Initiating client connection, connectString=192.168.220.130:2181,192.168.220.131:2181,192.168.220.132:2181 sessionTimeout=20000 watcher=null
2019-07-30 00:08:52,354 INFO [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server 192.168.220.130/192.168.220.130:2181. Will not attempt to authenticate using SASL (unknown error)
2019-07-30 00:08:52,356 INFO [org.apache.zookeeper.ClientCnxn] - Socket connection established to 192.168.220.130/192.168.220.130:2181, initiating session
2019-07-30 00:08:52,364 INFO [org.apache.zookeeper.ClientCnxn] - Session establishment complete on server 192.168.220.130/192.168.220.130:2181, sessionid = 0x16b29c2ee08000c, negotiated timeout = 20000
    ------>         <-----    ,    、    ...       ......
    ------->         <--------    LOL     5 ....
2019-07-30 00:08:52,366 ERROR [org.apache.zookeeper.ClientCnxn] - Error while calling watcher
java.lang.NullPointerException
at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:530)
at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:505)
 
D:\>java -jar BeautyAnchor.jar      
2019-07-30 00:10:21,794 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:zookeeper.version=3.4.8--1, built on 02/06/2016 03:18 GMT
2019-07-30 00:10:21,794 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:host.name=DESKTOP-RALNSM7
2019-07-30 00:10:21,794 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.version=1.8.0_111
2019-07-30 00:10:21,794 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.vendor=Oracle Corporation
2019-07-30 00:10:21,794 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.home=D:\JAVA\jre
2019-07-30 00:10:21,795 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.class.path=BeautyAnchor.jar
2019-07-30 00:10:21,795 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.library.path=D:\JAVA\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;D:\JAVA\bin;D:\JAVA\jre\binC:\ProgramData\Oracle\Java\javapath;D:\Hadoop_2.7.2dev\hadoop-2.7.2\bin;D:\Hadoop_2.7.2dev\hadoop-2.7.2\sbin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\devSoftware\python27;D:\devSoftware\python36\;D:\devSoftware\bin;D:\MAVEN\apache-maven-3.5.0\bin;D:\devSoftware\Scripts\;D:\devSoftware\;D:\devSoftware\python36\Scripts\;D:\osSoftware\;.
2019-07-30 00:10:21,795 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.io.tmpdir=C:\Users\lsh\AppData\Local\Temp\
2019-07-30 00:10:21,795 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.compiler=<NA>
2019-07-30 00:10:21,795 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.name=Windows 10
2019-07-30 00:10:21,795 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.arch=amd64
2019-07-30 00:10:21,795 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.version=10.0
2019-07-30 00:10:21,795 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.name=lsh
2019-07-30 00:10:21,795 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.home=C:\Users\lsh
2019-07-30 00:10:21,795 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.dir=D:\
2019-07-30 00:10:21,796 INFO [org.apache.zookeeper.ZooKeeper] - Initiating client connection, connectString=192.168.220.130:2181,192.168.220.131:2181,192.168.220.132:2181 sessionTimeout=20000 watcher=null
2019-07-30 00:10:21,894 INFO [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server 192.168.220.132/192.168.220.132:2181. Will not attempt to authenticate using SASL (unknown error)
2019-07-30 00:10:21,895 INFO [org.apache.zookeeper.ClientCnxn] - Socket connection established to 192.168.220.132/192.168.220.132:2181, initiating session
2019-07-30 00:10:21,903 INFO [org.apache.zookeeper.ClientCnxn] - Session establishment complete on server 192.168.220.132/192.168.220.132:2181, sessionid = 0x36b28a6cb09000b, negotiated timeout = 20000
2019-07-30 00:10:21,905 ERROR [org.apache.zookeeper.ClientCnxn] - Error while calling watcher
java.lang.NullPointerException
at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:530)
at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:505)
    ------>     <-----    ,    、    ...       ......
    ------->     <--------    LOL     5 ....
 
 
   :
 
<---------------         ----->    ョ     �
<---------------         ----->    ョ     �
<---------------         ----->   
=    !i===    !i======    !i==========    !i====    !i==
 
<---------------         ----->   
=    !i===    !i======    !i==========    !i====    !i==
 
VIP  -->    @ ======>     -->     --->     ,    ,    
<---------------         ----->         
<---------------         ----->    ョ     �
<---------------         ----->   
=    !i===    !i======    !i==========    !i====    !i==
 
<---------------         ----->         
<---------------         ----->     
<---------------         ----->    ョ     �
<---------------         ----->   
=    !i===    !i======    !i==========    !i====    !i==
 
<---------------         ----->         
<---------------         ----->     
<---------------         ----->     
<---------------         ----->    ョ     �
<---------------         ----->   
=    !i===    !i======    !i==========    !i====    !i==
 
############                                #######################
<---------------         ----->         
<---------------         ----->     
<---------------         ----->    ョ     �
<---------------         ----->   
=    !i===    !i======    !i==========    !i====    !i==
 
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Is Eclipse IDE dying?In 2014 the Eclipse IDE is the leading development environment for Java with a market share of approximately 65%. but ac...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.