本文整理汇总了Java中org.apache.commons.lang.time.StopWatch.start方法的典型用法代码示例。如果您正苦于以下问题:Java StopWatch.start方法的具体用法?Java StopWatch.start怎么用?Java StopWatch.start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang.time.StopWatch
的用法示例。
在下文中一共展示了StopWatch.start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadCache
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
/**
* 将数据库中的配置表进行缓存
*/
private void loadCache() {
StopWatch sw = new StopWatch();
sw.start();
LOGGER.info("start load config to cache");
Iterable<ServiceInfo> serviceInfos = this.serviceInfoRepository.findAll();
for (Iterator<ServiceInfo> it = serviceInfos.iterator(); it.hasNext();) {
ServiceInfo serviceInfo = it.next();
this.setOps.add(SERVICE_INFO_PREFIX, serviceInfo.getSid());
}
sw.stop();
LOGGER.info("load config to cache end, cost {} ms", sw.getTime());
}
示例2: testGetSingleItem
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
@Test
public void testGetSingleItem() {
StopWatch watch = new StopWatch();
LOG.info("testGetItem start --> " + watch);
watch.start();
TapestryDefinition tapestryDefinition = TapestryHandling.createFullTapestryFromPatterns(client, testFibres);
DrillDownThreads drillDownThreads =
ThreadNavigation.drillDownOnTypeId(client, tapestryDefinition, OsInstanceType.TYPE_LOCAL_ID, 0, true);
String instancesLogicalId = drillDownThreads.getItemThreadId();
QueryResult qr = client.getAggregation(tapestryDefinition.getId(), instancesLogicalId);
QueryResultElement qre = qr.getElements().get(0);
String logicalId = qre.getEntity().getLogicalId();
QueryResultElement itemElement = client.getItem(logicalId);
Item item = (Item) itemElement.getEntity();
assertNotNull(item);
assertEquals(logicalId, item.getLogicalId());
watch.stop();
LOG.info("testGetItem end --> " + watch);
}
示例3: testAdapterDeregistration
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
@Test
public void testAdapterDeregistration()
throws NoSuchProviderException, DuplicateAdapterException, DuplicateItemTypeException,
NullItemTypeIdException, DuplicatePatternException, NullPatternIdException, UnsupportedOperationException {
StopWatch watch = new StopWatch();
LOG.info("testing AdapterDeregistration");
watch.start();
Provider testProvider = new FakeProviderImpl("test", "test", "test", "test", "test", "com");
DoNothingAdapter dna = new DoNothingAdapter(testProvider);
dna.setAdapterManager(adapterManager, null);
adapterManager.registerAdapter(dna);
dna.onLoad();
assertTrue("provider is not registered", adapterManager.getProviders().contains(testProvider));
// now deregister
dna.onUnload();
assertFalse("provider is still registered", adapterManager.getProviders().contains(testProvider));
watch.stop();
LOG.info("tested AdapterDeregistration --> " + watch);
}
示例4: testCreateOneAggregationNullItemType
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testCreateOneAggregationNullItemType()
throws NoSuchSessionException, SessionAlreadyExistsException, DuplicateAdapterException,
LogicalIdAlreadyExistsException, NoSuchProviderException, DuplicateItemTypeException,
NullItemTypeIdException, DuplicatePatternException, NullPatternIdException, UnsupportedOperationException {
StopWatch watch = new StopWatch();
LOG.info("testing CreateOneAggregationNullItemType");
watch.start();
Provider prov = createProvider();
adapterManager.registerAdapter(createUnregisteredDoNothingAdapter(prov));
Session session = createSession();
aggregationManager.createSession(session);
adapterManager.createGroundedAggregation(session, prov, null, null, true, "vms",
"List of virtual machines - fake", 44);
watch.stop();
LOG.info("tested CreateOneAggregationNullItemType --> " + watch);
}
示例5: testCreateOneAggregationNullProvider
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testCreateOneAggregationNullProvider()
throws NoSuchSessionException, SessionAlreadyExistsException, DuplicateAdapterException,
LogicalIdAlreadyExistsException, NoSuchProviderException, DuplicateItemTypeException,
NullItemTypeIdException, DuplicatePatternException, NullPatternIdException, UnsupportedOperationException {
StopWatch watch = new StopWatch();
LOG.info("testing CreateOneAggregationNullProvider");
watch.start();
Provider prov = createProvider();
Adapter adapter = createUnregisteredDoNothingAdapter(prov);
// adapterManager.deregisterAdapter(adapter, new HashSet<Session>());
adapterManager.registerAdapter(adapter);
ItemType type = new FakeType();
adapterManager.addItemType(prov, type);
Session session = createSession();
aggregationManager.createSession(session);
adapterManager.createGroundedAggregation(session, null, type, null, true, "vms",
"List of virtual machines - fake", 44);
watch.stop();
LOG.info("tested CreateOneAggregationNullProvider --> " + watch);
}
示例6: testUserDisconnected
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
@Test
public void testUserDisconnected() throws NoSuchProviderException, DuplicateAdapterException,
NoSuchSessionException, SessionAlreadyExistsException, UserAlreadyConnectedException, NoSuchUserException,
DuplicateItemTypeException, NullItemTypeIdException, DuplicatePatternException, NullPatternIdException,
UnsupportedOperationException {
StopWatch watch = new StopWatch();
LOG.info("testing UserDisconnected");
watch.start();
Provider prov = createProvider();
DoNothingAdapter dna = createUnregisteredDoNothingAdapter(prov);
adapterManager.registerAdapter(dna);
Session session = new SessionImpl("id1", sessionManager.getInterval());
aggregationManager.createSession(session);
stitcher.createSession(session);
adapterManager.userConnected(session, dna.getProvider(), null);
assertTrue("both sessions should be the same", session.equals(dna.getSession()));
adapterManager.userDisconnected(session, dna.getProvider(), null);
adapterManager.deregisterAdapter(dna, new HashSet<>(0));
watch.stop();
LOG.info("tested UserDisconnected --> " + watch);
}
示例7: nonExistentAggregation
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
@Test(expected = NoSuchAggregationException.class)
public void nonExistentAggregation()
throws NoSuchSessionException, NoSuchTapestryDefinitionException, LogicalIdAlreadyExistsException,
NoSuchAggregationException, IllegalAccessException, OperationException, UnsupportedOperationException,
InvalidQueryInputException, NoSuchQueryDefinitionException, NoSuchThreadDefinitionException,
OperationNotSupportedException, InvalidQueryParametersException, PendingQueryResultsException,
ItemPropertyNotFound, RelationPropertyNotFound, IllegalArgumentException, ThreadDeletedByDynAdapterUnload {
tap = new TapestryDefinition();
tap.setThreads(groupBraidThreads);
tapestryManager.setTapestryDefinition(session, tap);
StopWatch watch = new StopWatch();
LOG.info("testing bad aggregation process");
List<String> badSources = new ArrayList<>(1);
badSources.add("/bad/sources");
watch.start();
groupBraidQuery.setInputs(badSources);
queryExec.processQuery(session, tap.getThreads().get(0));
watch.stop();
LOG.info("tested bad aggregation process --> " + watch);
}
示例8: testWrongUUIDRegister
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
@Test
public void testWrongUUIDRegister() {
StopWatch watch = new StopWatch();
LOG.info("testing OpMgrRegistration");
watch.start();
List<String> opList = opMgr.listOperations(UUID.randomUUID());
assertTrue(opList.size() == 0);
opMgr.registerOperation("FAKEOP", firstMeta, UUID.randomUUID());
assertEquals(startValues, opMgr.listOperations(OperationManagerImpl.LOOM_UUID).size());
opMgr.registerOperation("", firstMeta, OperationManagerImpl.LOOM_UUID);
assertEquals(startValues, opMgr.listOperations(OperationManagerImpl.LOOM_UUID).size());
opMgr.registerOperation("FAKEOP", null, OperationManagerImpl.LOOM_UUID);
assertEquals(startValues, opMgr.listOperations(OperationManagerImpl.LOOM_UUID).size());
watch.stop();
LOG.info("tested OpMgrRegistration --> " + watch);
}
示例9: testInstanceJson
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
@Test
public void testInstanceJson() throws Exception {
StopWatch watch = new StopWatch();
LOG.info("testing InstanceJson");
watch.start();
// create an instance Item
ItemType type = new OsInstanceType(provider);
type.setId("os-" + type.getLocalId());
OsInstance instance = new OsInstance("/os/fake/instances/i1", type);
OsInstanceAttributes oia = new OsInstanceAttributes(new OsFlavour("2", "m1.small", 20, 2048, 1));
oia.setItemName("vm1");
oia.setItemId("vmId1");
oia.setStatus("ACTIVE");
instance.setCore(oia);
LOG.info("created JSON is\n" + toJson(instance));
watch.stop();
LOG.info("tested InstanceJson --> " + watch);
}
示例10: testRegisterPatternsUnknownProvider
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
@Test(expected = NoSuchProviderException.class)
public void testRegisterPatternsUnknownProvider() throws NoSuchProviderException, DuplicateAdapterException,
DuplicatePatternException, NullPatternIdException, NoSuchPatternException, UnsupportedOperationException {
StopWatch watch = new StopWatch();
LOG.info("testing RegisterPatternsUnknownProvider");
watch.start();
Provider prov = createProvider();
createUnregisteredDoNothingAdapter(prov);
PatternDefinition pat1 = new PatternDefinition("pat1");
PatternDefinition pat2 = new PatternDefinition("pat2");
HashSet<PatternDefinition> patternSet = new HashSet<PatternDefinition>();
patternSet.add(pat1);
patternSet.add(pat2);
adapterManager.addPatternDefinitions(prov, patternSet);
watch.stop();
LOG.info("tested RegisterPatternsUnknownProvider --> " + watch);
}
示例11: testUserConnected
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
@Test
public void testUserConnected() throws NoSuchProviderException, DuplicateAdapterException, NoSuchSessionException,
SessionAlreadyExistsException, UserAlreadyConnectedException, DuplicateItemTypeException,
NullItemTypeIdException, DuplicatePatternException, NullPatternIdException, UnsupportedOperationException {
StopWatch watch = new StopWatch();
LOG.info("testing UserConnected");
watch.start();
Provider prov = createProvider();
DoNothingAdapter dna = createUnregisteredDoNothingAdapter(prov);
adapterManager.registerAdapter(dna);
Session session = createSession();
aggregationManager.createSession(session);
stitcher.createSession(session);
adapterManager.userConnected(session, dna.getProvider(), null);
assertTrue("both sessions should be the same", session.equals(dna.getSession()));
adapterManager.deregisterAdapter(dna, new HashSet<>(0));
watch.stop();
LOG.info("tested UserConnected --> " + watch);
}
示例12: loadCache
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
/**
* 将数据库中的配置表进行缓存
*/
private void loadCache() {
StopWatch sw = new StopWatch();
sw.start();
LOGGER.info("start load config to cache");
Iterable<NameInfo> nameInfos = this.nameInfoRepository.findAll();
for (Iterator<NameInfo> it = nameInfos.iterator(); it.hasNext();) {
NameInfo nameInfo = it.next();
this.setOps.add(mapping.get(nameInfo.getNameInfoPK().getType()), nameInfo.getNameInfoPK().getName());
}
sw.stop();
LOGGER.info("load config to cache end, cost {} ms", sw.getTime());
}
示例13: put
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
private <T> void put(final String url, final Object bodyObj, final java.lang.Class<T> tClass,
final Object... uriVariables) {
setErrorHandler();
StopWatch watch = new StopWatch();
watch.start();
restTemplate.put(url, bodyObj, tClass, uriVariables);
watch.stop();
if (log.isTraceEnabled()) {
// if (watch.getTime() > timeWarning) {
// bodyStr += " WARNING:";
// }
String args = "";
for (Object arg : uriVariables) {
args += " " + arg;
}
log.trace("PUT " + url + " " + args + " " + bodyObj + " Operation took " + watch);
}
}
示例14: nonExistentSession
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
@Test(expected = NoSuchSessionException.class)
public void nonExistentSession()
throws NoSuchSessionException, NoSuchTapestryDefinitionException, LogicalIdAlreadyExistsException,
NoSuchAggregationException, IllegalAccessException, OperationException, UnsupportedOperationException,
InvalidQueryInputException, NoSuchQueryDefinitionException, NoSuchThreadDefinitionException,
OperationNotSupportedException, InvalidQueryParametersException, PendingQueryResultsException,
ItemPropertyNotFound, RelationPropertyNotFound, IllegalArgumentException, ThreadDeletedByDynAdapterUnload {
tap = new TapestryDefinition();
tap.setThreads(groupBraidThreads);
tapestryManager.setTapestryDefinition(session, tap);
StopWatch watch = new StopWatch();
LOG.info("testing bad session process");
watch.start();
queryExec.processQuery(new SessionImpl(UUID.randomUUID().toString(), sessionManager.getInterval()),
tap.getThreads().get(0));
watch.stop();
LOG.info("tested bad session process --> " + watch);
}
示例15: testProcessGroupByQuery
import org.apache.commons.lang.time.StopWatch; //导入方法依赖的package包/类
@Test
public void testProcessGroupByQuery()
throws NoSuchSessionException, NoSuchTapestryDefinitionException, IllegalAccessException,
UnsupportedOperationException, OperationException, NoSuchAggregationException, InvalidQueryInputException,
LogicalIdAlreadyExistsException, NoSuchQueryDefinitionException, NoSuchThreadDefinitionException,
OperationNotSupportedException, InvalidQueryParametersException, PendingQueryResultsException,
JsonProcessingException, ItemPropertyNotFound, RelationPropertyNotFound, ThreadDeletedByDynAdapterUnload {
tap = new TapestryDefinition();
tap.setThreads(groupThreads);
tapestryManager.setTapestryDefinition(session, tap);
StopWatch watch = new StopWatch();
LOG.info("testing Query process");
watch.start();
QueryResult results = queryExec.processQuery(session, tap.getThreads().get(0));
// ObjectMapper mapper = new ObjectMapper();
// mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
// System.out.println(mapper.writeValueAsString(results));
assertTrue(results.getLogicalId().equals("/da/" + groupQuery.hashCode()));
assertTrue(results.getElements().size() == 4);
watch.stop();
LOG.info("tested Group By Query process --> " + watch);
}