use of org.apache.ignite.internal.client.GridClientConfiguration in project ignite by apache.
the class ClientAbstractSelfTest method clientConfiguration.
/**
* @return Test client configuration.
*/
protected GridClientConfiguration clientConfiguration() throws GridClientException {
GridClientConfiguration cfg = new GridClientConfiguration();
GridClientDataConfiguration nullCache = new GridClientDataConfiguration();
GridClientDataConfiguration cache = new GridClientDataConfiguration();
cache.setName(CACHE_NAME);
cfg.setDataConfigurations(Arrays.asList(nullCache, cache));
cfg.setProtocol(protocol());
cfg.setServers(Collections.singleton(serverAddress()));
// Setting custom executor, to avoid failures on client shutdown.
// And applying custom naming scheme to ease debugging.
cfg.setExecutorService(Executors.newCachedThreadPool(new ThreadFactory() {
private AtomicInteger cntr = new AtomicInteger();
@SuppressWarnings("NullableProblems")
@Override
public Thread newThread(Runnable r) {
return new Thread(r, "client-worker-thread-" + cntr.getAndIncrement());
}
}));
if (useSsl())
cfg.setSslContextFactory(sslContextFactory());
return cfg;
}
use of org.apache.ignite.internal.client.GridClientConfiguration in project ignite by apache.
the class TcpRouterAbstractSelfTest method clientConfiguration.
/** {@inheritDoc} */
@Override
protected GridClientConfiguration clientConfiguration() throws GridClientException {
GridClientConfiguration cfg = super.clientConfiguration();
cfg.setServers(Collections.<String>emptySet());
cfg.setRouters(Collections.singleton(HOST + ":" + ROUTER_PORT));
return cfg;
}
use of org.apache.ignite.internal.client.GridClientConfiguration in project ignite by apache.
the class TcpRouterMultiNodeSelfTest method clientConfiguration.
/** {@inheritDoc} */
@Override
protected GridClientConfiguration clientConfiguration() throws GridClientException {
GridClientConfiguration cfg = super.clientConfiguration();
cfg.setServers(Collections.<String>emptySet());
Collection<String> rtrs = new ArrayList<>(ROUTERS_CNT);
for (int i = 0; i < ROUTERS_CNT; i++) rtrs.add(HOST + ':' + (ROUTER_TCP_PORT_BASE + i));
cfg.setRouters(rtrs);
return cfg;
}
use of org.apache.ignite.internal.client.GridClientConfiguration in project ignite by apache.
the class ClientTcpUnreachableMultiNodeSelfTest method clientConfiguration.
/** {@inheritDoc} */
@Override
protected GridClientConfiguration clientConfiguration() throws GridClientException {
GridClientConfiguration cfg = super.clientConfiguration();
// Setting low connection timeout to allow multiple threads
// pass the unavailable address quickly.
cfg.setConnectTimeout(100);
return cfg;
}
use of org.apache.ignite.internal.client.GridClientConfiguration in project ignite by apache.
the class ClientFailedInitSelfTest method client.
/**
* @param p Protocol.
* @param useRouter Use router flag.
* @return Client instance.
* @throws GridClientException If failed.
*/
private GridClient client(GridClientProtocol p, boolean useRouter) throws GridClientException {
GridClientConfiguration cfg = new GridClientConfiguration();
int port = p == TCP ? (useRouter ? ROUTER_BINARY_PORT : BINARY_PORT) : (useRouter ? ROUTER_JETTY_PORT : JETTY_PORT);
cfg.setProtocol(p);
cfg.setServers(Arrays.asList(HOST + ":" + port));
cfg.setTopologyRefreshFrequency(TOP_REFRESH_PERIOD);
return GridClientFactory.start(cfg);
}
Aggregations