/** Setup */ @BeforeClass public static void setUpClass() throws Exception { serverNode = new SgsTestNode("TestScalableHashSet", null, null); txnScheduler = serverNode.getSystemRegistry().getComponent(TransactionScheduler.class); taskOwner = serverNode.getProxy().getCurrentOwner(); dataService = serverNode.getDataService(); }
private void doTestRead(boolean detectMods) throws Exception { Properties props = getNodeProps(); props.setProperty(DataServiceImplClass + ".detect.modifications", String.valueOf(detectMods)); props.setProperty("com.sun.sgs.txn.timeout", "10000"); serverNode = new SgsTestNode("TestDataServicePerformance", null, props); final DataService service = serverNode.getDataService(); TransactionScheduler txnScheduler = serverNode.getSystemRegistry().getComponent(TransactionScheduler.class); Identity taskOwner = serverNode.getProxy().getCurrentOwner(); txnScheduler.runTask( new AbstractKernelRunnable() { public void run() { service.setBinding("counters", new Counters(items)); } }, taskOwner); for (int r = 0; r < repeat; r++) { long start = System.currentTimeMillis(); for (int c = 0; c < count; c++) { txnScheduler.runTask( new AbstractKernelRunnable() { public void run() throws Exception { Counters counters = (Counters) service.getBinding("counters"); for (int i = 0; i < items; i++) { counters.get(i); } } }, taskOwner); } long stop = System.currentTimeMillis(); System.err.println("Time: " + (stop - start) / (float) count + " ms per transaction"); } }
/** Test management. */ @Before public void startup() throws Exception { Properties properties = SgsTestNode.getDefaultProperties("TestAccessCoordinatorImpl", null, null); properties.setProperty("com.sun.sgs.finalService", "DataService"); properties.setProperty("com.sun.sgs.txn.timeout", "1000000"); serverNode = new SgsTestNode("TestAccessCoordinatorImpl", null, properties); taskOwner = serverNode.getProxy().getCurrentOwner(); txnScheduler = serverNode.getSystemRegistry().getComponent(TransactionScheduler.class); dataService = serverNode.getDataService(); accessCoordinator = serverNode.getSystemRegistry().getComponent(AccessCoordinator.class); }