本文整理汇总了Java中com.hivemq.spi.services.PluginExecutorService类的典型用法代码示例。如果您正苦于以下问题:Java PluginExecutorService类的具体用法?Java PluginExecutorService怎么用?Java PluginExecutorService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PluginExecutorService类属于com.hivemq.spi.services包,在下文中一共展示了PluginExecutorService类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: InfluxDbConfiguration
import com.hivemq.spi.services.PluginExecutorService; //导入依赖的package包/类
@Inject
public InfluxDbConfiguration(final PluginExecutorService pluginExecutorService,
final SystemInformation systemInformation) {
super(pluginExecutorService, systemInformation);
final ValueChangedCallback<String> callback = new ValueChangedCallback<String>() {
@Override
public void valueChanged(final String newValue) {
if (listener != null) {
listener.restart();
}
}
};
addCallback("mode", callback);
addCallback("host", callback);
addCallback("port", callback);
addCallback("protocol", callback);
addCallback("reportingInterval", callback);
addCallback("prefix", callback);
addCallback("database", callback);
addCallback("auth", callback);
addCallback("connectTimeout", callback);
addCallback("tags", callback);
}
示例2: ConsulDiscoveryCallback
import com.hivemq.spi.services.PluginExecutorService; //导入依赖的package包/类
@Inject
public ConsulDiscoveryCallback(final Consul consul,
final Configuration configuration,
final PluginExecutorService pluginExecutorService) {
this.consul = consul;
this.configuration = configuration;
this.pluginExecutorService = pluginExecutorService;
}
示例3: S3DiscoveryCallback
import com.hivemq.spi.services.PluginExecutorService; //导入依赖的package包/类
@Inject
public S3DiscoveryCallback(final AmazonS3 s3,
final Configuration configuration,
final PluginExecutorService pluginExecutorService) {
this.s3 = s3;
this.s3.setEndpoint(configuration.getEndpoint());
this.s3.setS3ClientOptions(new S3ClientOptions().withPathStyleAccess(configuration.withPathStyleAccess()));
this.configuration = configuration;
this.pluginExecutorService = pluginExecutorService;
this.bucketName = configuration.getBucketName();
}
示例4: Configuration
import com.hivemq.spi.services.PluginExecutorService; //导入依赖的package包/类
@Inject
public Configuration(final PluginExecutorService pluginExecutorService, SystemInformation systemInformation) {
super(pluginExecutorService, systemInformation);
this.pluginExecutorService = pluginExecutorService;
this.systemInformation = systemInformation;
init();
final ValueChangedCallback callback = new ValueChangedCallback() {
@Override
public void valueChanged(final Object newValue) {
if (listener != null) {
listener.restart();
}
}
};
addCallback("filename", callback);
addCallback("reloadCredentialsInterval.seconds", callback);
addCallback("passwordHashing.enabled", callback);
addCallback("passwordHashing.iterations", callback);
addCallback("passwordHashing.algorithm", callback);
addCallback("passwordHashingSalt.separationChar", callback);
addCallback("passwordHashingSalt.enabled", callback);
addCallback("passwordHashingSalt.isFirst", callback);
addCallback("cachingTime.seconds", callback);
addCallback("cacheSize", callback);
}
示例5: CredentialsConfiguration
import com.hivemq.spi.services.PluginExecutorService; //导入依赖的package包/类
@Inject
public CredentialsConfiguration(final PluginExecutorService pluginExecutorService, final String filename, final int reloadSeconds, final SystemInformation systemInformation) {
super(pluginExecutorService, systemInformation);
this.callbacks = new ArrayList<>();
this.filename = filename;
this.reloadSeconds = reloadSeconds;
}
示例6: fullPluginLifecycleWithDefaultConfiguration
import com.hivemq.spi.services.PluginExecutorService; //导入依赖的package包/类
@Test
public void fullPluginLifecycleWithDefaultConfiguration() throws ExecutionException, InterruptedException {
// dummy consul client
Consul consul = mock(Consul.class);
AgentClient agentClient = mock(AgentClient.class);
when(consul.agentClient()).thenReturn(agentClient);
// empty config
ConfigurationReader configurationReader = mock(ConfigurationReader.class);
Properties properties = new Properties();
when(configurationReader.getProperties()).thenReturn(properties);
Configuration configuration = new Configuration(configurationReader);
PluginExecutorService pluginExecutorService = mock(PluginExecutorService.class);
ConsulDiscoveryCallback callback = new ConsulDiscoveryCallback(consul, configuration, pluginExecutorService);
callback.init("clusternode1", new ClusterNodeAddress("clusternode1-hostname", 1234));
// check if registration job gets scheduled
ArgumentCaptor<Runnable> runnableArgument = ArgumentCaptor.forClass(Runnable.class);
verify(pluginExecutorService, times(2)).scheduleAtFixedRate(runnableArgument.capture(), anyLong(), eq(60l), eq(TimeUnit.SECONDS));
// run registration job
Runnable registrationRunnable = runnableArgument.getAllValues().get(0);
Runnable updateRunnable = runnableArgument.getAllValues().get(1);
registrationRunnable.run();
// verify service registration
ArgumentCaptor<Registration> argument = ArgumentCaptor.forClass(Registration.class);
verify(agentClient).register(argument.capture(), any());
Registration registration = argument.getValue();
assertEquals("cluster-discovery-hivemq", registration.getName());
assertEquals("clusternode1-hostname", registration.getAddress().get());
assertEquals(Integer.valueOf(1234), registration.getPort().get());
assertEquals("cluster-discovery-hivemq", registration.getName());
String registrationId = registration.getId();
assertThat(registrationId).containsOnlyDigits();
assertEquals(1, registration.getChecks().size());
Registration.RegCheck regCheck = registration.getChecks().get(0);
assertEquals("120s", regCheck.getTtl().get());
// run updater job and check consul service pass call
updateRunnable.run();
try {
verify(agentClient).pass(eq(registrationId));
} catch (NotRegisteredException e) {
throw new RuntimeException(e);
}
HealthClient healthClient = mock(HealthClient.class);
List<ServiceHealth> nodes = new ArrayList<>();
Service service = ImmutableService.builder()
.address("host1")
.id("not important")
.service("doesnt matter")
.port(5678).build();
Node node = ImmutableNode.builder().node("node1").address("address1").build();
ServiceHealth serviceHealth = ImmutableServiceHealth.builder().service(service).node(node).build();
nodes.add(serviceHealth);
ConsulResponse response = new ConsulResponse(nodes, 0, true, BigInteger.ZERO);
when(healthClient.getHealthyServiceInstances(anyString(), ArgumentMatchers.<ImmutableQueryOptions>any())).thenReturn(response);
when(consul.healthClient()).thenReturn(healthClient);
List<ClusterNodeAddress> addresses = callback.getNodeAddresses().get();
assertEquals(1, addresses.size());
assertEquals("host1", addresses.get(0).getHost());
assertEquals(5678, addresses.get(0).getPort());
callback.destroy();
verify(agentClient).deregister(eq(registrationId));
}
开发者ID:pellepelster,项目名称:hivemq-consul-cluster-discovery,代码行数:81,代码来源:ConsulDiscoveryCallbackTest.java
示例7: ReloadingPropertiesReader
import com.hivemq.spi.services.PluginExecutorService; //导入依赖的package包/类
ReloadingPropertiesReader(final PluginExecutorService pluginExecutorService,
final SystemInformation systemInformation) {
this.pluginExecutorService = pluginExecutorService;
this.systemInformation = systemInformation;
}
示例8: TestReloadingPropertiesReader
import com.hivemq.spi.services.PluginExecutorService; //导入依赖的package包/类
public TestReloadingPropertiesReader(final PluginExecutorService pluginExecutorService, final SystemInformation systemInformation, final String filename) {
super(pluginExecutorService, systemInformation);
this.filename = filename;
}
示例9: PersistMessagesCallback
import com.hivemq.spi.services.PluginExecutorService; //导入依赖的package包/类
@Inject
public PersistMessagesCallback(final Provider<Connection> connectionProvider,
final PluginExecutorService pluginExecutorService) {
this.connectionProvider = connectionProvider;
this.pluginExecutorService = pluginExecutorService;
}
示例10: ReloadingPropertiesReader
import com.hivemq.spi.services.PluginExecutorService; //导入依赖的package包/类
public ReloadingPropertiesReader(final PluginExecutorService pluginExecutorService, final SystemInformation systemInformation) {
this.pluginExecutorService = pluginExecutorService;
this.systemInformation = systemInformation;
}