Search in sources :

Example 1 with ThinClientConfiguration

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[]
}
Also used : ThinClientConfiguration(org.apache.ignite.configuration.ThinClientConfiguration) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) IgniteClient(org.apache.ignite.client.IgniteClient) ClientConnectorConfiguration(org.apache.ignite.configuration.ClientConnectorConfiguration) Ignite(org.apache.ignite.Ignite) ClientConfiguration(org.apache.ignite.configuration.ClientConfiguration) ThinClientConfiguration(org.apache.ignite.configuration.ThinClientConfiguration)

Example 2 with ThinClientConfiguration

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;
}
Also used : ThinClientConfiguration(org.apache.ignite.configuration.ThinClientConfiguration) ClientConnectorConfiguration(org.apache.ignite.configuration.ClientConnectorConfiguration)

Example 3 with ThinClientConfiguration

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);
}
Also used : ThinClientConfiguration(org.apache.ignite.configuration.ThinClientConfiguration)

Example 4 with ThinClientConfiguration

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;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) ThinClientConfiguration(org.apache.ignite.configuration.ThinClientConfiguration) ClientConnectorConfiguration(org.apache.ignite.configuration.ClientConnectorConfiguration)

Aggregations

ThinClientConfiguration (org.apache.ignite.configuration.ThinClientConfiguration)4 ClientConnectorConfiguration (org.apache.ignite.configuration.ClientConnectorConfiguration)3 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)2 Ignite (org.apache.ignite.Ignite)1 IgniteClient (org.apache.ignite.client.IgniteClient)1 ClientConfiguration (org.apache.ignite.configuration.ClientConfiguration)1