Search in sources :

Example 1 with GridClientJdkMarshaller

use of org.apache.ignite.internal.client.marshaller.jdk.GridClientJdkMarshaller in project ignite by apache.

the class MapReduceClient method client.

/**
     * Gets the client.
     *
     * @return The client.
     */
public GridClient client() throws IOException {
    GridClient cli0 = cli;
    if (cli0 == null) {
        synchronized (mux) {
            cli0 = cli;
            if (cli0 == null) {
                GridClientConfiguration cliCfg = new GridClientConfiguration();
                cliCfg.setProtocol(TCP);
                cliCfg.setServers(addrs);
                cliCfg.setMarshaller(new GridClientJdkMarshaller());
                // 1 day.
                cliCfg.setMaxConnectionIdleTime(24 * 60 * 60 * 1000L);
                cliCfg.setDaemon(true);
                try {
                    cli0 = GridClientFactory.start(cliCfg);
                    cli = cli0;
                } catch (GridClientException e) {
                    throw new IOException("Failed to establish connection with Ignite: " + addrs, e);
                }
            }
        }
    }
    return cli0;
}
Also used : GridClientException(org.apache.ignite.internal.client.GridClientException) GridClientJdkMarshaller(org.apache.ignite.internal.client.marshaller.jdk.GridClientJdkMarshaller) GridClient(org.apache.ignite.internal.client.GridClient) IOException(java.io.IOException) GridClientConfiguration(org.apache.ignite.internal.client.GridClientConfiguration)

Example 2 with GridClientJdkMarshaller

use of org.apache.ignite.internal.client.marshaller.jdk.GridClientJdkMarshaller in project ignite by apache.

the class GridTcpRestProtocol method onKernalStart.

/** {@inheritDoc} */
@Override
public void onKernalStart() {
    super.onKernalStart();
    Map<Byte, GridClientMarshaller> marshMap = new HashMap<>();
    ArrayList<PluginProvider> providers = new ArrayList<>(ctx.plugins().allProviders());
    GridClientOptimizedMarshaller optMarsh = new GridClientOptimizedMarshaller(providers);
    marshMap.put(GridClientOptimizedMarshaller.ID, optMarsh);
    marshMap.put(GridClientZipOptimizedMarshaller.ID, new GridClientZipOptimizedMarshaller(optMarsh, providers));
    marshMap.put(GridClientJdkMarshaller.ID, new GridClientJdkMarshaller());
    lsnr.marshallers(marshMap);
}
Also used : GridClientJdkMarshaller(org.apache.ignite.internal.client.marshaller.jdk.GridClientJdkMarshaller) GridClientMarshaller(org.apache.ignite.internal.client.marshaller.GridClientMarshaller) GridClientOptimizedMarshaller(org.apache.ignite.internal.client.marshaller.optimized.GridClientOptimizedMarshaller) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) PluginProvider(org.apache.ignite.plugin.PluginProvider) GridClientZipOptimizedMarshaller(org.apache.ignite.internal.client.marshaller.optimized.GridClientZipOptimizedMarshaller)

Aggregations

GridClientJdkMarshaller (org.apache.ignite.internal.client.marshaller.jdk.GridClientJdkMarshaller)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 GridClient (org.apache.ignite.internal.client.GridClient)1 GridClientConfiguration (org.apache.ignite.internal.client.GridClientConfiguration)1 GridClientException (org.apache.ignite.internal.client.GridClientException)1 GridClientMarshaller (org.apache.ignite.internal.client.marshaller.GridClientMarshaller)1 GridClientOptimizedMarshaller (org.apache.ignite.internal.client.marshaller.optimized.GridClientOptimizedMarshaller)1 GridClientZipOptimizedMarshaller (org.apache.ignite.internal.client.marshaller.optimized.GridClientZipOptimizedMarshaller)1 PluginProvider (org.apache.ignite.plugin.PluginProvider)1