當前位置: 首頁>>代碼示例>>Java>>正文


Java StopWatch.createStarted方法代碼示例

本文整理匯總了Java中org.apache.commons.lang3.time.StopWatch.createStarted方法的典型用法代碼示例。如果您正苦於以下問題:Java StopWatch.createStarted方法的具體用法?Java StopWatch.createStarted怎麽用?Java StopWatch.createStarted使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.lang3.time.StopWatch的用法示例。


在下文中一共展示了StopWatch.createStarted方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createKafkaConsumer

import org.apache.commons.lang3.time.StopWatch; //導入方法依賴的package包/類
/**
 * Create topic consumer.
 * @param tenant the kafka topic
 */
public void createKafkaConsumer(String tenant) {
    StopWatch stopWatch = StopWatch.createStarted();
    try {
        log.info("START - SETUP:CreateTenant:kafka consumer tenantKey: {}", tenant);
        ConcurrentMessageListenerContainer<String, String> container = consumers.get(tenant);
        if (container != null) {
            if (!container.isRunning()) {
                container.start();
            }
        } else {
            ContainerProperties containerProps = new ContainerProperties(tenant);
            container = new ConcurrentMessageListenerContainer<>(consumerFactory, containerProps);
            container.setupMessageListener((MessageListener<String, String>) consumer::consumeEvent);
            container.setBeanName(tenant);
            container.start();
            consumers.put(tenant, container);
        }
        log.info("STOP  - SETUP:CreateTenant:kafka consumer tenantKey: {}, result: OK, time = {} ms",
            tenant, stopWatch.getTime());
    } catch (Exception e) {
        log.error("STOP  - SETUP:CreateTenant:kafka consumer tenantKey: {}, result: FAIL, error: {}, time = {} ms",
            tenant, e.getMessage(), stopWatch.getTime(), e);
    }
}
 
開發者ID:xm-online,項目名稱:xm-ms-timeline,代碼行數:29,代碼來源:KafkaService.java

示例2: createTenant

import org.apache.commons.lang3.time.StopWatch; //導入方法依賴的package包/類
/**
 * Create tenant.
 * @param tenant tenant key
 */
public void createTenant(String tenant) {
    StopWatch stopWatch = StopWatch.createStarted();
    log.info("START - SETUP:CreateTenant: tenantKey: {}", tenant);

    try {
        tenantListRepository.addTenant(tenant);
        databaseService.create(tenant);
        databaseService.migrate(tenant);
        addUaaSpecification(tenant);
        addLoginsSpecification(tenant);
        log.info("STOP  - SETUP:CreateTenant: tenantKey: {}, result: OK, time = {} ms",
            tenant, stopWatch.getTime());
    } catch (Exception e) {
        log.info("STOP  - SETUP:CreateTenant: tenantKey: {}, result: FAIL, error: {}, time = {} ms",
            tenant, e.getMessage(), stopWatch.getTime());
        throw e;
    }
}
 
開發者ID:xm-online,項目名稱:xm-uaa,代碼行數:23,代碼來源:TenantService.java

示例3: deleteTenant

import org.apache.commons.lang3.time.StopWatch; //導入方法依賴的package包/類
/**
 * Delete tenant.
 * @param tenant tenant key
 */
public void deleteTenant(String tenant) {
    StopWatch stopWatch = StopWatch.createStarted();
    log.info("START - SETUP:DeleteTenant: tenantKey: {}", tenant);

    try {
        databaseService.drop(tenant);
        tenantListRepository.deleteTenant(tenant);

        tenantConfigRepository.deleteConfig(tenant.toUpperCase(),
            "/" + applicationProperties.getTenantPropertiesName());
        tenantConfigRepository.deleteConfig(tenant.toUpperCase(),
            "/" + applicationProperties.getTenantLoginPropertiesName());


        log.info("STOP  - SETUP:DeleteTenant: tenantKey: {}, result: OK, time = {} ms",
            tenant, stopWatch.getTime());
    } catch (Exception e) {
        log.info("STOP  - SETUP:DeleteTenant: tenantKey: {}, result: FAIL, error: {}, time = {} ms",
            tenant, e.getMessage(), stopWatch.getTime());
        throw e;
    }
}
 
開發者ID:xm-online,項目名稱:xm-uaa,代碼行數:27,代碼來源:TenantService.java

示例4: logBeforeService

import org.apache.commons.lang3.time.StopWatch; //導入方法依賴的package包/類
/**
 * Aspect for logging before service calls.
 *
 * @param joinPoint joinPoint
 * @return method result
 * @throws Throwable throwable
 */
@SneakyThrows
@Around("servicePointcut() && !excluded()")
public Object logBeforeService(ProceedingJoinPoint joinPoint) {

    StopWatch stopWatch = StopWatch.createStarted();

    try {
        logStart(joinPoint);

        Object result = joinPoint.proceed();

        logStop(joinPoint, result, stopWatch);

        return result;
    } catch (Exception e) {
        logError(joinPoint, e, stopWatch);
        throw e;
    }

}
 
開發者ID:xm-online,項目名稱:xm-commons,代碼行數:28,代碼來源:ServiceLoggingAspect.java

示例5: create

import org.apache.commons.lang3.time.StopWatch; //導入方法依賴的package包/類
/**
 * Create default dashboard.
 * @param tenant - the tenant
 */
public void create(Tenant tenant) {
    final StopWatch stopWatch = StopWatch.createStarted();
    final String tenantKey = tenant.getTenantKey();
    TenantInfo info = TenantContext.getCurrent();
    try {
        log.info("START - SETUP:CreateTenant:dashboard tenantKey: {}", tenantKey);

        TenantContext.setCurrentQuite(tenantKey);

        Dashboard dashboard = new Dashboard();
        dashboard.setName(tenantKey.toLowerCase());
        dashboard.setOwner(tenantKey.toLowerCase());
        dashboard.setIsPublic(false);
        dashboardService.save(dashboard);

        log.info("STOP  - SETUP:CreateTenant:dashboard tenantKey: {}, result: OK, time = {} ms", tenantKey,
            stopWatch.getTime());
    } catch (Exception e) {
        log.info("STOP  - SETUP:CreateTenant:dashboard tenantKey: {}, result: FAIL, error: {}, time = {} ms",
            tenantKey, e.getMessage(), stopWatch.getTime());
        throw e;
    } finally {
        TenantContext.setCurrentQuite(info);
    }
}
 
開發者ID:xm-online,項目名稱:xm-ms-dashboard,代碼行數:30,代碼來源:TenantDashboardService.java

示例6: addTenant

import org.apache.commons.lang3.time.StopWatch; //導入方法依賴的package包/類
public void addTenant(Tenant tenant) {
    StopWatch stopWatch = StopWatch.createStarted();
    log.info("START - SETUP:CreateTenant: tenantKey: {}", tenant);

    try {
        String tenantName = tenant.getTenantKey().toUpperCase();
        tenantListRepository.addTenant(tenantName);
        tenantDatabaseService.create(tenant);
        tenantElasticService.create(tenant);
        addEntitySpecification(tenantName);
        addWebAppSpecification(tenantName);
        log.info("STOP  - SETUP:CreateTenant: tenantKey: {}, result: OK, time = {} ms",
            tenant, stopWatch.getTime());
    } catch (Exception e) {
        log.info("STOP  - SETUP:CreateTenant: tenantKey: {}, result: FAIL, error: {}, time = {} ms",
            tenant, e.getMessage(), stopWatch.getTime());
        throw e;
    }
}
 
開發者ID:xm-online,項目名稱:xm-ms-entity,代碼行數:20,代碼來源:TenantService.java

示例7: deleteTenant

import org.apache.commons.lang3.time.StopWatch; //導入方法依賴的package包/類
public void deleteTenant(String tenantKey) {
    StopWatch stopWatch = StopWatch.createStarted();
    log.info("START - SETUP:DeleteTenant: tenantKey: {}", tenantKey);

    try {
        tenantDatabaseService.drop(tenantKey);
        tenantElasticService.delete(tenantKey);
        tenantListRepository.deleteTenant(tenantKey.toLowerCase());

        String specificationName = applicationProperties.getSpecificationName();
        tenantConfigRepository.deleteConfig(tenantKey.toUpperCase(), "/" + specificationName);

        String webappSpecificationName = applicationProperties.getSpecificationWebappName();
        webappTenantConfigRepository.deleteConfig(tenantKey.toUpperCase(), "/" + webappSpecificationName);

        log.info("STOP  - SETUP:DeleteTenant: tenantKey: {}, result: OK, time = {} ms",
            tenantKey, stopWatch.getTime());
    } catch (Exception e) {
        log.info("STOP  - SETUP:DeleteTenant: tenantKey: {}, result: FAIL, error: {}, time = {} ms",
            tenantKey, e.getMessage(), stopWatch.getTime());
        throw e;
    }
}
 
開發者ID:xm-online,項目名稱:xm-ms-entity,代碼行數:24,代碼來源:TenantService.java

示例8: createTenant

import org.apache.commons.lang3.time.StopWatch; //導入方法依賴的package包/類
/**
 * Create new tenant.
 * @param tenant the new tenant name
 */
public void createTenant(String tenant) {
    StopWatch stopWatch = StopWatch.createStarted();
    log.info("START - SETUP:CreateTenant: tenantKey: {}", tenant);

    try {
        tenantListRepository.addTenant(tenant.toLowerCase());
        cassandraService.createCassandraKeyspace(tenant);
        cassandraService.migrateCassandra(tenant);
        kafkaService.createKafkaTopic(tenant);
        kafkaService.sendCommand(tenant, Constants.CREATE_COMMAND);
        addTimelineSpecification(tenant.toUpperCase());

        log.info("STOP  - SETUP:CreateTenant: tenantKey: {}, result: OK, time = {} ms",
            tenant, stopWatch.getTime());
    } catch (Exception e) {
        log.info("STOP  - SETUP:CreateTenant: tenantKey: {}, result: FAIL, error: {}, time = {} ms",
            tenant, e.getMessage(), stopWatch.getTime());
        throw e;
    }
}
 
開發者ID:xm-online,項目名稱:xm-ms-timeline,代碼行數:25,代碼來源:TenantService.java

示例9: deleteTenant

import org.apache.commons.lang3.time.StopWatch; //導入方法依賴的package包/類
/**
 * Delete tenant.
 * @param tenant the tenant name
 */
public void deleteTenant(String tenant) {
    StopWatch stopWatch = StopWatch.createStarted();
    log.info("START - SETUP:DeleteTenant: tenantKey: {}", tenant);

    try {
        cassandraService.dropCassandraKeyspace(tenant);
        kafkaService.deleteKafkaTopic(tenant);
        kafkaService.sendCommand(tenant, Constants.DELETE_COMMAND);
        tenantListRepository.deleteTenant(tenant.toLowerCase());

        String specificationName = applicationProperties.getTenantPropertiesName();
        tenantConfigRepository.deleteConfig(tenant.toUpperCase(), "/" + specificationName);

        log.info("STOP  - SETUP:DeleteTenant: tenantKey: {}, result: OK, time = {} ms",
            tenant, stopWatch.getTime());
    } catch (Exception e) {
        log.info("STOP  - SETUP:DeleteTenant: tenantKey: {}, result: FAIL, error: {}, time = {} ms",
            tenant, e.getMessage(), stopWatch.getTime());
        throw e;
    }
}
 
開發者ID:xm-online,項目名稱:xm-ms-timeline,代碼行數:26,代碼來源:TenantService.java

示例10: deleteKafkaConsumer

import org.apache.commons.lang3.time.StopWatch; //導入方法依賴的package包/類
/**
 * Delete topic consumer.
 * @param tenant the kafka topic
 */
public void deleteKafkaConsumer(String tenant) {
    StopWatch stopWatch = StopWatch.createStarted();
    try {
        log.info("START - SETUP:DeleteTenant:kafka consumer tenantKey: {}", tenant);
        if (consumers.get(tenant) != null) {
            consumers.get(tenant).stop();
            consumers.remove(tenant);
        }
        log.info("STOP  - SETUP:DeleteTenant:kafka consumer tenantKey: {}, result: OK, time = {} ms",
            tenant, stopWatch.getTime());
    } catch (Exception e) {
        log.error("STOP  - SETUP:DeleteTenant:kafka consumer tenantKey: {}, result: FAIL, error: {}, time = {} ms",
            tenant, e.getMessage(), stopWatch.getTime(), e);
    }
}
 
開發者ID:xm-online,項目名稱:xm-ms-timeline,代碼行數:20,代碼來源:KafkaService.java

示例11: sendCommand

import org.apache.commons.lang3.time.StopWatch; //導入方法依賴的package包/類
/**
 * Send 'tenant management' command to system topic.
 * @param tenant the tenant to manage
 * @param command the command (e.g. CREATE, DELETE, ...)
 */
public void sendCommand(String tenant, String command) {
    StopWatch stopWatch = StopWatch.createStarted();
    try {
        log.info("START - SETUP:ManageTenant:kafka send command tenantKey: {}, command: {}",
            tenant, command);
        template.send(properties.getKafkaSystemTopic(), tenant, createSystemEvent(tenant, command));
        log.info("STOP  - SETUP:ManageTenant:kafka send command tenantKey: {}, command: {},"
                + " result: OK, time = {} ms",
            tenant, command, stopWatch.getTime());
    } catch (Exception e) {
        log.error("STOP  - SETUP:ManageTenant:kafka send command tenantKey: {}, command: {},"
                + " result: FAIL, error: {}, time = {} ms",
            tenant, command, e.getMessage(), stopWatch.getTime());
        throw e;
    }
}
 
開發者ID:xm-online,項目名稱:xm-ms-timeline,代碼行數:22,代碼來源:KafkaService.java

示例12: createCassandraKeyspace

import org.apache.commons.lang3.time.StopWatch; //導入方法依賴的package包/類
/**
 * Create cassandra keyspace.
 * @param tenant the keyspace name
 */
public void createCassandraKeyspace(String tenant) {
    StopWatch stopWatch = StopWatch.createStarted();
    try {
        log.info("START - SETUP:CreateTenant:cassandra keyspace tenantKey: {}", tenant);
        Cluster.builder().addContactPoints(cassandraProperties.getContactPoints())
            .build().connect().execute(String.format(properties.getCassandra().getKeyspaceCreateCql(), tenant));
        log.info("STOP  - SETUP:CreateTenant:cassandra keyspace tenantKey: {}, result: OK, time = {} ms",
            tenant, stopWatch.getTime());
    } catch (Exception e) {
        log.error("STOP  - SETUP:CreateTenant:cassandra keyspace tenantKey: {}, result: FAIL,"
                + " error: {}, time = {} ms",
            tenant, e.getMessage(), stopWatch.getTime());
        throw e;
    }
}
 
開發者ID:xm-online,項目名稱:xm-ms-timeline,代碼行數:20,代碼來源:CassandraService.java

示例13: migrateCassandra

import org.apache.commons.lang3.time.StopWatch; //導入方法依賴的package包/類
/**
 * Migrate cassandra keyspace.
 * @param tenant the keyspace name
 */
public void migrateCassandra(String tenant) {
    StopWatch stopWatch = StopWatch.createStarted();
    try {
        log.info("START - SETUP:CreateTenant:cassandra migration tenantKey: {}", tenant);
        ClusterConfiguration clusterConfiguration = new ClusterConfiguration();
        clusterConfiguration.setContactpoints(new String[]{cassandraProperties.getContactPoints()});

        KeyspaceConfiguration keyspaceConfiguration = new KeyspaceConfiguration();
        keyspaceConfiguration.setName(tenant.toLowerCase());
        keyspaceConfiguration.setClusterConfig(clusterConfiguration);

        CassandraMigration cm = new CassandraMigration();
        cm.setLocations(new String[]{properties.getCassandra().getMigrationFolder()});
        cm.setKeyspaceConfig(keyspaceConfiguration);
        cm.migrate();
        log.info("STOP  - SETUP:CreateTenant:cassandra migration tenantKey: {}, result: OK, time = {} ms",
            tenant, stopWatch.getTime());
    } catch (Exception e) {
        log.error("STOP  - SETUP:CreateTenant:cassandra migration tenantKey: {},"
                + " result: FAIL, error: {}, time = {} ms",
            tenant, e.getMessage(), stopWatch.getTime());
        throw e;
    }
}
 
開發者ID:xm-online,項目名稱:xm-ms-timeline,代碼行數:29,代碼來源:CassandraService.java

示例14: runAnalysis

import org.apache.commons.lang3.time.StopWatch; //導入方法依賴的package包/類
private void runAnalysis(List<FilterSet> filterSets, ComplexFilterScore optimum, double rangeReduction)
{
	plots.clear();
	plots.ensureCapacity(plotTopN);
	bestFilter.clear();
	bestFilterOrder.clear();

	getCoordinateStore();

	filterAnalysisStopWatch = StopWatch.createStarted();
	IJ.showStatus("Analysing filters ...");
	int setNumber = 0;
	DirectFilter currentOptimum = (optimum != null) ? optimum.r.filter : null;
	for (FilterSet filterSet : filterSets)
	{
		setNumber++;
		if (filterAnalysis(filterSet, setNumber, currentOptimum, rangeReduction) < 0)
			break;
	}
	filterAnalysisStopWatch.stop();
	IJ.showProgress(1);
	IJ.showStatus("");

	final String timeString = filterAnalysisStopWatch.toString();
	IJ.log("Filter analysis time : " + timeString);
}
 
開發者ID:aherbert,項目名稱:GDSC-SMLM,代碼行數:27,代碼來源:BenchmarkFilterAnalysis.java

示例15: manageTenant

import org.apache.commons.lang3.time.StopWatch; //導入方法依賴的package包/類
public void manageTenant(String tenant, String state) {
    StopWatch stopWatch = StopWatch.createStarted();
    log.info("START - SETUP:ManageTenant: tenantKey: {}, state: {}", tenant, state);

    try {
        tenantListRepository.updateTenant(tenant.toLowerCase(), state.toUpperCase());

        log.info("STOP  - SETUP:ManageTenant: tenantKey: {}, state: {}, result: OK, time = {} ms",
            tenant, state, stopWatch.getTime());
    } catch (Exception e) {
        log.info("STOP  - SETUP:ManageTenant: tenantKey: {}, state: {}, result: FAIL, error: {}, time = {} ms",
            tenant, state, e.getMessage(), stopWatch.getTime());
        throw e;
    }
}
 
開發者ID:xm-online,項目名稱:xm-uaa,代碼行數:16,代碼來源:TenantService.java


注:本文中的org.apache.commons.lang3.time.StopWatch.createStarted方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。