Example usage for java.lang Integer valueOf

List of usage examples for java.lang Integer valueOf

Introduction

In this page you can find the example usage for java.lang Integer valueOf.

Prototype

@HotSpotIntrinsicCandidate
public static Integer valueOf(int i) 

Source Link

Document

Returns an Integer instance representing the specified int value.

Usage

From source file:WBSTest.java

/**
 * @param args
 */
public static void main(String[] args) {
    System.out.println(Integer.valueOf(2012).toString());
    initTorque();
}

From source file:com.asual.summer.onejar.OneJarServer.java

public static void main(String[] args) throws Exception {
    Server server = new Server(Integer.valueOf(System.getProperty("server.port", "8080")));
    server.setHandler(new WebAppContext(getCurrentWarFile(), System.getProperty("server.contextPath", "/")));
    try {//from w ww  .  j a va  2 s  .c  o  m
        server.start();
    } catch (Exception e) {
        server.stop();
        e.printStackTrace();
        System.exit(-1);
    }
}

From source file:net.socket.bio.TimeClient.java

/**
 * @param args/*www .  j ava2 s.c om*/
 */
public static void main(String[] args) {

    int port = 8089;
    if (args != null && args.length > 0) {

        try {
            port = Integer.valueOf(args[0]);
        } catch (NumberFormatException e) {
            // 
        }

    }
    Socket socket = null;
    BufferedReader in = null;
    PrintWriter out = null;
    try {
        socket = new Socket("127.0.0.1", port);
        in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        out = new PrintWriter(socket.getOutputStream(), true);
        out.println("QUERY TIME ORDER");
        out.println("QUERY TIME ORDER");
        String test = StringUtils.repeat("hello tcp", 1000);
        out.println(test);
        System.out.println("Send order 2 server succeed.");
        String resp = in.readLine();
        System.out.println("Now is : " + resp);
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        IOUtils.closeQuietly(out);
        IOUtils.closeQuietly(in);
        IOUtils.closeQuietly(socket);
    }
}

From source file:com.usefullc.solm.common.proxy.nio.NIOSocketServer.java

public static void main(String[] args) {
    try {/*from ww w . ja va2 s .  c o m*/
        //proxy connect pool
        System.setProperty("htmlDir", args[0]);
        int port = Integer.valueOf(args[1]);
        ServerMgr.init(port);
        //end

        System.out.println("htmlDir=" + args[0]);
        System.out.println("port=" + args[1]);

        ProxyTaskExecutor.start(); //?

        new Thread(new Runnable() {
            @Override
            public void run() {
                ServerMgr.startServer();

                //                    ReadHandler.start();  //?browser req and server res ?
            }
        }).start();

        System.out.println("server is start at " + ServerMgr.getPort());

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.sm.store.TestEchoServer.java

public static void main(String[] args) {
    String[] opts = new String[] { "-store", "-path", "-port" };
    String[] defaults = new String[] { "store", "./storepath", "7420" };
    String[] paras = getOpts(args, opts, defaults);
    String p0 = paras[0];//w  w  w.  j a  v  a  2  s.c  o m
    int port = Integer.valueOf(paras[2]);
    logger.info("start server at " + port);
    TCPServer s = TCPServer.start(port, new AppSyncHandler(2, 100));
    RemoteStore remoteStore = new RemoteStore("Test", null, 1);

}

From source file:com.sm.replica.TestServer.java

public static void main(String[] args) {
    String[] opts = new String[] { "-store", "-path", "-port", "-mode" };
    String[] defaults = new String[] { "store", "./data", "6900", "0" };
    String[] paras = getOpts(args, opts, defaults);
    String store = paras[0];/* w  w w.  ja  v a  2 s  .  c o m*/
    int port = Integer.valueOf(paras[2]);
    String path = paras[1];
    int mode = Integer.valueOf(paras[3]);
    CacheStore cacheStore = new CacheStore(path, null, 0, store, false, mode);
    HashMap<String, CacheStore> storesMap = new HashMap<String, CacheStore>();
    storesMap.put(store, cacheStore);
    logger.info("start server at " + port);
    ReplicaServer server = new ReplicaServer(port, storesMap);

}

From source file:com.example.main.Main.java

/**
 * @param args/*w w  w . j a  v a  2s. c  om*/
 */
public static void main(String[] args) throws Exception {
    String webappDirLocation = "src/main/webapp/";

    // The port that we should run on can be set into an environment variable
    // Look for that variable and default to 8080 if it isn't there.
    String webPort = System.getenv("PORT");
    if (webPort == null || webPort.isEmpty()) {
        webPort = "8082";
    }

    Server server = new Server(Integer.valueOf(webPort));
    WebAppContext root = new WebAppContext();

    root.setContextPath("/");
    root.setDescriptor(webappDirLocation + "/WEB-INF/web.xml");
    root.setResourceBase(webappDirLocation);

    PersistenceManager.getInstance().getEntityManagerFactory();

    // Parent loader priority is a class loader setting that Jetty accepts.
    // By default Jetty will behave like most web containers in that it will
    // allow your application to replace non-server libraries that are part of the
    // container. Setting parent loader priority to true changes this behavior.
    // Read more here: http://wiki.eclipse.org/Jetty/Reference/Jetty_Classloading
    root.setParentLoaderPriority(true);

    try {
        JSONObject datos = new JSONObject();
        datos.put("nombrePagina", "Competencias");
        datos.put("urlPagina", "localHost:8082");
        JSONObject datos2 = new JSONObject();
        datos2.put("nombrePagina", "Competencias");
        datos2.put("nuevoEstado", "Activo");
        JSONObject datos3 = new JSONObject();
        datos3.put("nombrePagina", "Competencias");
        datos3.put("nombreServicio", "Competencias");
        datos3.put("rutaServicio", "Competencias");
        JSONObject datos4 = new JSONObject();
        datos4.put("nombrePagina", "Competencias");
        datos4.put("nombreServicio", "Ganadores");
        datos4.put("rutaServicio", "Competencias/winners/{name}");

        Client client = Client.create();
        WebResource target = client.resource(SERVIDOR_ZK + "inscribirPagina");
        target.post(JSONObject.class, datos);
        target = client.resource(SERVIDOR_ZK + "estadoPagina");
        target.post(JSONObject.class, datos2);
        target = client.resource(SERVIDOR_ZK + "servicioPagina");
        target.post(JSONObject.class, datos3);
        target = client.resource(SERVIDOR_ZK + "servicioPagina");
        target.post(JSONObject.class, datos4);

        client.destroy();

    } catch (Exception e) {
        e.printStackTrace();
    }

    server.setHandler(root);

    server.start();
    server.join();
}

From source file:com.sm.store.TestScanKey.java

public static void main(String[] args) throws Exception {
    String[] opts = new String[] { "-store", "-path", "-port", "-mode", "-sorted" };
    String[] defaults = new String[] { "store", "./data", "7100", "0", "true" };
    String[] paras = getOpts(args, opts, defaults);
    String store = paras[0];//from  w w  w .j a  v  a  2  s .com
    int port = Integer.valueOf(paras[2]);
    String path = paras[1];
    int mode = Integer.valueOf(paras[3]);
    SortedCacheStore sortedStore = new SortedCacheStore(path, null, 0, store, true, mode);
    Key from = findFloorKey(sortedStore.getSkipListMap(), Key.createKey("cmp1000000"));
    Key to = findCeilKey(sortedStore.getSkipListMap(), Key.createKey("cmp1000101"));
    System.out.print("test " + from.toString() + " " + to.toString());
}

From source file:com.sm.store.TestGZStoreServer.java

public static void main(String[] args) {
    String[] opts = new String[] { "-store", "-path", "-port", "-mode", "-delay" };
    String[] defaults = new String[] { "store", "./data", "7100", "0", "false" };
    String[] paras = getOpts(args, opts, defaults);
    String p0 = paras[0];/* ww w  .j  a  v a 2 s  . c om*/
    int port = Integer.valueOf(paras[2]);
    String path = paras[1];
    int mode = Integer.valueOf(paras[3]);
    boolean delay = Boolean.valueOf(paras[4]);
    String[] stores = p0.split(",");
    List<TupleThree<String, String, Integer>> storeList = new ArrayList<TupleThree<String, String, Integer>>();
    for (String store : stores) {
        storeList.add(new TupleThree<String, String, Integer>(store, path, mode));

    }
    GZRemoteStoreServer rs = new GZRemoteStoreServer(port, storeList, delay);
    logger.info("hookup jvm shutdown process");
    rs.hookShutdown();
    List list = new ArrayList();
    //add jmx metric
    for (String store : stores) {
        list.add(rs.getRemoteStore(store));
    }
    list.add(rs);
    JmxService jms = new JmxService(list);
}

From source file:com.sm.store.TestStoreClient.java

public static void main(String[] args) {
    String[] opts = new String[] { "-store", "-url", "-times" };
    String[] defaults = new String[] { "store", "localhost:7100", "10" };
    String[] paras = getOpts(args, opts, defaults);
    String store = paras[0];// ww  w. j  ava2 s .co  m
    String url = paras[1];
    int times = Integer.valueOf(paras[2]);
    RemotePersistence client = new NTRemoteClientImpl(url, null, store, false);
    for (int i = 0; i < times; i++) {
        try {
            Key key = Key.createKey(i);
            client.put(key, "times-" + i);
            Value value = client.get(key);
            logger.info(value == null ? "null" : value.getData().toString() + " " + value.getVersion());
            //value.setVersion( value.getVersion() -1);
            client.put(key, value);
            value = client.get(key);
            logger.info(value == null ? "null" : value.getData().toString() + " " + value.getVersion());
            client.put(key, "times-" + i);
            value = client.get(key);
            logger.info(value == null ? "null" : value.getData().toString() + " " + value.getVersion());
        } catch (Exception ex) {
            logger.error(ex.getMessage(), ex);

        }

    }
    List<Key> list = client.getKeyList();
    logger.info("key size " + list.size());
    client.close();
    System.exit(0);

}