org.apache.curator.drivers.TracerDriver Java Examples

The following examples show how to use org.apache.curator.drivers.TracerDriver. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConnectionState.java    From xian with Apache License 2.0 5 votes vote down vote up
ConnectionState(ZookeeperFactory zookeeperFactory, EnsembleProvider ensembleProvider, int sessionTimeoutMs, int connectionTimeoutMs, Watcher parentWatcher, AtomicReference<TracerDriver> tracer, boolean canBeReadOnly)
{
    this.ensembleProvider = ensembleProvider;
    this.sessionTimeoutMs = sessionTimeoutMs;
    this.connectionTimeoutMs = connectionTimeoutMs;
    this.tracer = tracer;
    if ( parentWatcher != null )
    {
        parentWatchers.offer(parentWatcher);
    }

    zooKeeper = new HandleHolder(zookeeperFactory, this, ensembleProvider, sessionTimeoutMs, canBeReadOnly);
}
 
Example #2
Source File: ZookeeperAutoConfiguration.java    From spring-cloud-zookeeper with Apache License 2.0 5 votes vote down vote up
@Bean(destroyMethod = "close")
@ConditionalOnMissingBean
public CuratorFramework curatorFramework(RetryPolicy retryPolicy,
		ZookeeperProperties properties,
		ObjectProvider<CuratorFrameworkCustomizer> optionalCuratorFrameworkCustomizerProvider,
		ObjectProvider<EnsembleProvider> optionalEnsembleProvider,
		ObjectProvider<TracerDriver> optionalTracerDriverProvider) throws Exception {
	CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder();

	EnsembleProvider ensembleProvider = optionalEnsembleProvider.getIfAvailable();
	if (ensembleProvider != null) {
		builder.ensembleProvider(ensembleProvider);
	}
	else {
		builder.connectString(properties.getConnectString());
	}
	builder.sessionTimeoutMs((int) properties.getSessionTimeout().toMillis())
			.connectionTimeoutMs((int) properties.getConnectionTimeout().toMillis())
			.retryPolicy(retryPolicy);

	optionalCuratorFrameworkCustomizerProvider.orderedStream()
			.forEach(curatorFrameworkCustomizer -> curatorFrameworkCustomizer
					.customize(builder));

	CuratorFramework curator = builder.build();
	optionalTracerDriverProvider.ifAvailable(tracerDriver -> {
		if (curator.getZookeeperClient() != null) {
			curator.getZookeeperClient().setTracerDriver(tracerDriver);
		}
	});

	curator.start();
	log.trace("blocking until connected to zookeeper for "
			+ properties.getBlockUntilConnectedWait()
			+ properties.getBlockUntilConnectedUnit());
	curator.blockUntilConnected(properties.getBlockUntilConnectedWait(),
			properties.getBlockUntilConnectedUnit());
	log.trace("connected to zookeeper");
	return curator;
}
 
Example #3
Source File: ConnectionState.java    From curator with Apache License 2.0 5 votes vote down vote up
ConnectionState(ZookeeperFactory zookeeperFactory, EnsembleProvider ensembleProvider, int sessionTimeoutMs, Watcher parentWatcher, AtomicReference<TracerDriver> tracer, boolean canBeReadOnly)
{
    this.ensembleProvider = ensembleProvider;
    this.tracer = tracer;
    if ( parentWatcher != null )
    {
        parentWatchers.offer(parentWatcher);
    }

    handleHolder = new HandleHolder(zookeeperFactory, this, ensembleProvider, sessionTimeoutMs, canBeReadOnly);
}
 
Example #4
Source File: RetryLoop.java    From xian with Apache License 2.0 4 votes vote down vote up
RetryLoop(RetryPolicy retryPolicy, AtomicReference<TracerDriver> tracer)
{
    this.retryPolicy = retryPolicy;
    this.tracer = tracer;
}
 
Example #5
Source File: OperationTrace.java    From xian with Apache License 2.0 4 votes vote down vote up
public OperationTrace(String name, TracerDriver driver) {
  this(name, driver, -1);
}
 
Example #6
Source File: OperationTrace.java    From xian with Apache License 2.0 4 votes vote down vote up
public OperationTrace(String name, TracerDriver driver, long sessionId) {
  this.name = name;
  this.driver = driver;
  this.sessionId = sessionId;
}
 
Example #7
Source File: ZookeeperAutoConfigurationTests.java    From spring-cloud-zookeeper with Apache License 2.0 4 votes vote down vote up
@Bean
TracerDriver mockedTracerDriver() {
	return mock(TracerDriver.class);
}
 
Example #8
Source File: OperationTrace.java    From curator with Apache License 2.0 4 votes vote down vote up
public OperationTrace(String name, TracerDriver driver) {
  this(name, driver, -1);
}
 
Example #9
Source File: OperationTrace.java    From curator with Apache License 2.0 4 votes vote down vote up
public OperationTrace(String name, TracerDriver driver, long sessionId) {
  this.name = name;
  this.driver = driver;
  this.sessionId = sessionId;
}
 
Example #10
Source File: RetryLoopImpl.java    From curator with Apache License 2.0 4 votes vote down vote up
RetryLoopImpl(RetryPolicy retryPolicy, AtomicReference<TracerDriver> tracer)
{
    this.retryPolicy = retryPolicy;
    this.tracer = tracer;
}
 
Example #11
Source File: TimeTrace.java    From xian with Apache License 2.0 2 votes vote down vote up
/**
 * Create and start a timer
 *
 * @param name name of the event
 * @param driver driver
 */
public TimeTrace(String name, TracerDriver driver)
{
    this.name = name;
    this.driver = driver;
}
 
Example #12
Source File: CuratorZookeeperClient.java    From xian with Apache License 2.0 2 votes vote down vote up
/**
 * Return the current tracing driver
 *
 * @return tracing driver
 */
public TracerDriver       getTracerDriver()
{
    return tracer.get();
}
 
Example #13
Source File: CuratorZookeeperClient.java    From xian with Apache License 2.0 2 votes vote down vote up
/**
 * Change the tracing driver
 *
 * @param tracer new tracing driver
 */
public void               setTracerDriver(TracerDriver tracer)
{
    this.tracer.set(tracer);
}
 
Example #14
Source File: TimeTrace.java    From curator with Apache License 2.0 2 votes vote down vote up
/**
 * Create and start a timer
 *
 * @param name name of the event
 * @param driver driver
 */
public TimeTrace(String name, TracerDriver driver)
{
    this.name = name;
    this.driver = driver;
}
 
Example #15
Source File: CuratorZookeeperClient.java    From curator with Apache License 2.0 2 votes vote down vote up
/**
 * Return the current tracing driver
 *
 * @return tracing driver
 */
public TracerDriver getTracerDriver()
{
    return tracer.get();
}
 
Example #16
Source File: CuratorZookeeperClient.java    From curator with Apache License 2.0 2 votes vote down vote up
/**
 * Change the tracing driver
 *
 * @param tracer new tracing driver
 */
public void setTracerDriver(TracerDriver tracer)
{
    this.tracer.set(tracer);
}