use of org.apache.ignite.configuration.ThinClientConfiguration in project ignite by apache.
the class JavaThinClient method clientCompute.
void clientCompute() throws Exception {
// tag::client-compute-setup[]
ThinClientConfiguration thinClientCfg = new ThinClientConfiguration().setMaxActiveComputeTasksPerConnection(100);
ClientConnectorConfiguration clientConnectorCfg = new ClientConnectorConfiguration().setThinClientConfiguration(thinClientCfg);
IgniteConfiguration igniteCfg = new IgniteConfiguration().setClientConnectorConfiguration(clientConnectorCfg);
Ignite ignite = Ignition.start(igniteCfg);
// end::client-compute-setup[]
ClientConfiguration clientCfg = new ClientConfiguration().setAddresses("127.0.0.1:10800");
// tag::client-compute-task[]
try (IgniteClient client = Ignition.startClient(clientCfg)) {
// Suppose that the MyTask class is already deployed in the cluster
client.compute().execute(MyTask.class.getName(), "argument");
}
// end::client-compute-task[]
}
use of org.apache.ignite.configuration.ThinClientConfiguration in project ignite by apache.
the class PlatformConfigurationUtils method readClientConnectorConfiguration.
/**
* Reads the client connector configuration.
*
* @param in Reader.
* @return Config.
*/
private static ClientConnectorConfiguration readClientConnectorConfiguration(BinaryRawReader in) {
ClientConnectorConfiguration cfg = new ClientConnectorConfiguration().setHost(in.readString()).setPort(in.readInt()).setPortRange(in.readInt()).setSocketSendBufferSize(in.readInt()).setSocketReceiveBufferSize(in.readInt()).setTcpNoDelay(in.readBoolean()).setMaxOpenCursorsPerConnection(in.readInt()).setThreadPoolSize(in.readInt()).setIdleTimeout(in.readLong()).setThinClientEnabled(in.readBoolean()).setOdbcEnabled(in.readBoolean()).setJdbcEnabled(in.readBoolean());
cfg.setHandshakeTimeout(in.readLong());
if (in.readBoolean()) {
cfg.setThinClientConfiguration(new ThinClientConfiguration().setMaxActiveTxPerConnection(in.readInt()).setMaxActiveComputeTasksPerConnection(in.readInt()).sendServerExceptionStackTraceToClient(in.readBoolean()));
}
return cfg;
}
use of org.apache.ignite.configuration.ThinClientConfiguration in project ignite by apache.
the class PlatformConfigurationUtils method writeClientConnectorConfiguration.
/**
* Writes the client connector configuration.
*
* @param w Writer.
*/
private static void writeClientConnectorConfiguration(BinaryRawWriter w, ClientConnectorConfiguration cfg) {
assert w != null;
if (cfg != null) {
w.writeBoolean(true);
w.writeString(cfg.getHost());
w.writeInt(cfg.getPort());
w.writeInt(cfg.getPortRange());
w.writeInt(cfg.getSocketSendBufferSize());
w.writeInt(cfg.getSocketReceiveBufferSize());
w.writeBoolean(cfg.isTcpNoDelay());
w.writeInt(cfg.getMaxOpenCursorsPerConnection());
w.writeInt(cfg.getThreadPoolSize());
w.writeLong(cfg.getIdleTimeout());
w.writeBoolean(cfg.isThinClientEnabled());
w.writeBoolean(cfg.isOdbcEnabled());
w.writeBoolean(cfg.isJdbcEnabled());
w.writeLong(cfg.getIdleTimeout());
ThinClientConfiguration thinCfg = cfg.getThinClientConfiguration();
if (thinCfg != null) {
w.writeBoolean(true);
w.writeInt(thinCfg.getMaxActiveTxPerConnection());
w.writeInt(thinCfg.getMaxActiveComputeTasksPerConnection());
w.writeBoolean(thinCfg.sendServerExceptionStackTraceToClient());
} else
w.writeBoolean(false);
} else
w.writeBoolean(false);
}
use of org.apache.ignite.configuration.ThinClientConfiguration in project ignite by apache.
the class PerformanceStatisticsThinClientTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setCacheConfiguration(defaultCacheConfiguration());
cfg.setClientConnectorConfiguration(new ClientConnectorConfiguration().setThinClientConfiguration(new ThinClientConfiguration().setMaxActiveComputeTasksPerConnection(ACTIVE_TASKS_LIMIT)));
return cfg;
}
Aggregations