List of usage examples for java.lang Integer valueOf
@HotSpotIntrinsicCandidate public static Integer valueOf(int i)
From source file:com.sm.store.TestStoreServer.java
public static void main(String[] args) { String[] opts = new String[] { "-store", "-path", "-port", "-mode", "-delay" }; String[] defaults = new String[] { "store", "./storepath", "7100", "0", "false" }; String[] paras = getOpts(args, opts, defaults); String p0 = paras[0];//from w ww . j a va2 s .c o m 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)); } RemoteStoreServer rs = new RemoteStoreServer(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.isoftstone.proxy.Program.java
public static void main(String[] args) throws IOException { int insertIntervalTime = Integer.valueOf(Config.getValue("proxy_insert_minutes")); int checkIntervalTime = Integer.valueOf(Config.getValue("proxy_check_minute")); SchedulerFactory sf = new StdSchedulerFactory(); Scheduler sched;//from w w w. j a v a 2 s . c o m try { sched = sf.getScheduler(); // ???? JobDetail parseProxyJob = JobBuilder.newJob(ParseProxyJob.class).withIdentity("parseProxyJob", "Group") .build(); SimpleTrigger parseProxyTrigger = (SimpleTrigger) TriggerBuilder .newTrigger().withIdentity("parseProxyJob", "Group").withSchedule(SimpleScheduleBuilder .simpleSchedule().withIntervalInMinutes(insertIntervalTime).repeatForever()) .startAt(new Date()).build(); sched.scheduleJob(parseProxyJob, parseProxyTrigger); // ?? JobDetail checkProxyJob = JobBuilder.newJob(CheckProxyJob.class).withIdentity("checkProxyJob", "Group") .build(); /** * 10s?. */ Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.SECOND, 10); SimpleTrigger checkProxyTrigger = (SimpleTrigger) TriggerBuilder.newTrigger() .withIdentity("checkProxyJob", "Group").withSchedule(SimpleScheduleBuilder.simpleSchedule() .withIntervalInMinutes(checkIntervalTime).repeatForever()) .startAt(calendar.getTime()).build(); sched.scheduleJob(checkProxyJob, checkProxyTrigger); sched.start(); String uriHost = Config.getValue("http_server_host"); URI baseUri = UriBuilder.fromUri(uriHost).port(9998).build(); ResourceConfig config = new ResourceConfig(HttpProxyServer.class); HttpServer server = GrizzlyHttpServerFactory.createHttpServer(baseUri, config); } catch (SchedulerException e) { LOG.error("SchedulerException", e); } }
From source file:test.gov.nih.nci.system.web.client.ProductUpdateClient.java
public static void main(String[] args) { try {/*from www. j a v a 2 s . c o m*/ Product product = new Product(); product.setName("IPad2"); OrderLine line = new OrderLine(); line.setName("IPad"); line.setId(Integer.valueOf(6)); product.setLine(line); if (args == null || args.length != 1) { System.out.println("Usage: RESTFulReadClient <RESTful resource URL>"); return; } String url = args[0]; File myFile = marshall(product); RESTfulUpdateClient client = new RESTfulUpdateClient(); client.update(myFile, url); } catch (Exception e) { e.printStackTrace(); } }
From source file:graphgen.GraphGen.java
/** * @param args the command line arguments *///from ww w.jav a 2 s.c o m public static void main(String[] args) { Options options = new Options(); HelpFormatter formatter = new HelpFormatter(); options.addOption(OPTION_EDGES, true, OPTION_EDGES_MSG); options.addOption(OPTION_NODES, true, OPTION_NODES_MSG); options.addOption(OPTION_OUTPUT, true, OPTION_OUTPUT_MSG); CommandLineParser parser = new BasicParser(); try { CommandLine cmd = parser.parse(options, args); int edgeCount = Integer.valueOf(cmd.getOptionValue(OPTION_EDGES)); int nodeCount = Integer.valueOf(cmd.getOptionValue(OPTION_NODES)); String outputFile = cmd.getOptionValue(OPTION_OUTPUT); if ((nodeCount < edgeCount) || (outputFile != null)) { String graph = generateGraph(nodeCount, edgeCount); saveGraph(graph, outputFile); } else { formatter.printHelp(HELP_NAME, options); } } catch (NumberFormatException | ParseException e) { formatter.printHelp(HELP_NAME, options); } catch (IllegalArgumentException | FileNotFoundException e) { System.err.println(e.getMessage()); } }
From source file:async.nio2.Main.java
public static void main(String[] args) throws IOException, InterruptedException, ExecutionException { if (args.length == 3) { PORT = Integer.valueOf(args[0]); NO_CLIENTS = Integer.valueOf(args[1]); NO_SAMPLES = Integer.valueOf(args[2]); }/*from w ww . j a v a 2 s . com*/ if (PORT < 0) { System.err.println("Error: port < 0"); System.exit(1); } if (NO_CLIENTS < 1) { System.err.println("Error: #clients < 1"); System.exit(1); } if (NO_SAMPLES < 1) { System.err.println("Error: #samples < 1"); System.exit(1); } AsynchronousChannelGroup groupServer = AsynchronousChannelGroup .withThreadPool(Executors.newFixedThreadPool(1)); AsynchronousChannelGroup groupClient = AsynchronousChannelGroup .withThreadPool(Executors.newFixedThreadPool(1)); Server server = Server.newInstance(new InetSocketAddress("localhost", PORT), groupServer); InetSocketAddress localAddress = server.getLocalAddress(); String hostname = localAddress.getHostName(); int port = localAddress.getPort(); ExecutorService es = Executors.newFixedThreadPool(2); System.out.printf("%03d clients on %s:%d, %03d runs each. All times in s.%n", NO_CLIENTS, hostname, port, NO_SAMPLES); range(0, NO_CLIENTS).unordered().parallel() .mapToObj(i -> CompletableFuture.supplyAsync(newClient(localAddress, groupClient), es).join()) .map(array -> Arrays.stream(array).reduce(new DescriptiveStatistics(), Main::accumulate, Main::combine)) .map(Main::toEvaluationString).forEach(System.out::println); es.shutdown(); es.awaitTermination(5, TimeUnit.SECONDS); groupClient.shutdown(); groupClient.awaitTermination(5, TimeUnit.SECONDS); server.close(); groupServer.shutdown(); groupServer.awaitTermination(5, TimeUnit.SECONDS); }
From source file:TreeHeap.java
public static void main(String[] args) { Heap heap = new TreeHeap(5); for (int ai = 0; ai < args.length; ai++) { heap.add(Integer.valueOf(Integer.parseInt(args[ai]))); }/*w w w. j a v a2 s .co m*/ while (!heap.isEmpty()) { System.out.print(heap.extract() + " "); } System.out.println(); }
From source file:test.gov.nih.nci.system.web.client.HardDriveClient.java
public static void main(String[] args) { try {//from w w w . j av a 2 s . c o m Computer computer = new Computer(); computer.setType("DellPC"); computer.setId(9); HardDrive hardDrive = new HardDrive(); hardDrive.setComputer(computer); hardDrive.setSize(Integer.valueOf(1000)); if (args == null || args.length != 1) { System.out.println("Usage: RESTFulReadClient <RESTful resource URL>"); return; } String url = args[0]; File myFile = marshall(hardDrive); RESTfulCreateClient client = new RESTfulCreateClient(); client.create(myFile, url); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.sm.store.TestRemotePopulate.java
public static void main(String[] args) { String[] opts = new String[] { "-store", "-url", "-times" }; String[] defaults = new String[] { "campaignsperday", "las1-ssusd001.sm-us.sm.local:7240", "10" }; String[] paras = getOpts(args, opts, defaults); String store = paras[0];/* w w w . j a va 2 s . c o m*/ String url = paras[1]; int times = Integer.valueOf(paras[2]); HessianSerializer serializer = new HessianSerializer(); RemotePersistence client = new NTRemoteClientImpl(url, null, store); for (int i = 0; i < times; i++) { try { //Key key = Key.createKey("cmp"+i); //Campaign campaign = new Campaign(1, 1, i, false, false, "test"+i, null, null, null, null, null); //logger.info(campaign); //byte[] campaignBytes = serializer.toBytes(campaign); // Value val = new RemoteValue(campaignBytes, 0, (short) 0); Key key = Key.createKey("usr" + i); List<String> campaignIds = new ArrayList<String>(); campaignIds.add("cmp" + i); ////campaignIds.add("cmp"+i+i); //byte[] campaignIdsBytes = serializer.toBytes(campaignIds); Value val = new RemoteValue(campaignIds, 0, (short) 0); // // Key key = Key.createKey("cmp"+i+"."+20130116); // Delivery delivery = new Delivery(i, i+1, i*2, (i*2)+1, i*3, (i*3)+1, i*4, (i*4)+1, i*5, (i*5)+1); // byte[] deliveryBytes = serializer.toBytes(delivery); // Value val = new RemoteValue(deliveryBytes, 0, (short) 0); // client.put( key, val); // // key = Key.createKey("cmp"+i+"."+20130117); // delivery = new Delivery(i, i+2, i*2, (i*2)+2, i*3, (i*3)+2, i*4, (i*4)+2, i*5, (i*5)+2); // deliveryBytes = serializer.toBytes(delivery); // val = new RemoteValue(deliveryBytes, 0, (short) 0); client.put(key, val); Value value = client.get(key); logger.info("campaign value data: " + (List<String>) value.getData()); logger.info(value == null ? "null" : value.getData().toString()); } catch (Exception ex) { logger.error(ex.getMessage(), ex); } } client.close(); }
From source file:org.huahinframework.manager.Runner.java
/** * @param args/*w w w .j a v a2 s .c o m*/ */ public static void main(String[] args) { if (args.length != 2) { System.err.println("argument error: [war path] [port]"); System.exit(-1); } String war = args[0]; int port = Integer.valueOf(args[1]); Runner runner = new Runner(); runner.start(war, port); System.exit(0); }
From source file:com.liferay.mobile.sdk.SDKBuilder.java
public static void main(String[] args) throws IOException { SDKBuilder builder = new SDKBuilder(); Map<String, String> arguments = builder.parseArguments(args); String[] platforms = arguments.get("platforms").split(","); String url = arguments.get("url"); String[] contexts = arguments.get("contexts").split(","); String packageName = arguments.get("packageName"); String filter = arguments.get("filter"); int portalVersion = Integer.valueOf(arguments.get("portalVersion")); String destination = arguments.get("destination"); try {/* w w w.j a v a 2s . c o m*/ builder.build(platforms, url, contexts, packageName, filter, portalVersion, destination); } catch (Exception e) { _log.log(Level.SEVERE, e.getMessage(), e); } }