public void connect() throws IllegalArgumentException, UnknownHostException, AlreadyConnectedException { try { // connect to server server.connect(); } catch (final JIException e) { System.out.println( String.format("%08X: %s", e.getErrorCode(), server.getErrorMessage(e.getErrorCode()))); } }
private void testSteps() throws Exception { long start = System.currentTimeMillis(); int limit = count_number * NUMBER; // LOGGER.info("[" + limit + ":]" + "Step-" + limit + ":"); // LOGGER.info("[" + limit + ":]" + "startDate[" + new Date() // + "],CurrentMillis:" + start); Server server = new Server(config(), null); server.connect(); Group group = server.addGroup(count_number + ""); Item[] items = new Item[NUMBER]; long createStart = System.currentTimeMillis(); // LOGGER.info("[" + limit + "W:]" + "Create the items[" + new Date() // + "],CurrentMillis:" + createStart); for (int i = (count_number - 1) * NUMBER; i < limit; i++) { Item item = group.addItem("Random.Real" + i); items[i % NUMBER] = item; } long createEnd = System.currentTimeMillis(); // LOGGER.info("[" + limit + "W:]" + "Create finish [" + new Date() // + "],CurrentMillis:" + createEnd); long read = System.currentTimeMillis(); // LOGGER.info("[" + limit + "W:]" + "Start Read[" + new Date() // + "],CurrentMillis:" + read); SyncMultiThreadTest.start(read); group.read(true, items); long end = System.currentTimeMillis(); // LOGGER.info("[" + limit + "W:]" + "End Read[" + new Date() // + "],CurrentMillis:" + end); SyncMultiThreadTest.end(end); // LOGGER.info(MessageFormat.format("[" + limit + "W:]" // + "Total[{0}], CreateItem[{1}], Read[{2}]", end - start, // createEnd - createStart, end - read)); group.clear(); group.remove(); server.dispose(); }