Search in sources :

Example 1 with JdkMarshaller

use of org.apache.ignite.marshaller.jdk.JdkMarshaller in project ignite by apache.

the class HadoopExternalProcessStarter method run.

/**
     * Run the process.
     *
     * @throws Exception If failed.
     */
public void run() throws Exception {
    File outputDir = outputDirectory();
    initializeStreams(outputDir);
    ExecutorService msgExecSvc = Executors.newFixedThreadPool(Integer.getInteger("MSG_THREAD_POOL_SIZE", Runtime.getRuntime().availableProcessors() * 2));
    IgniteLogger log = logger(outputDir);
    HadoopExternalCommunication comm = new HadoopExternalCommunication(args.nodeId, args.childProcId, new JdkMarshaller(), log, msgExecSvc, "external", args.workDir);
    comm.start();
    HadoopProcessDescriptor nodeDesc = new HadoopProcessDescriptor(args.nodeId, args.parentProcId);
    nodeDesc.address(args.addr);
    nodeDesc.tcpPort(args.tcpPort);
    nodeDesc.sharedMemoryPort(args.shmemPort);
    HadoopChildProcessRunner runner = new HadoopChildProcessRunner();
    runner.start(comm, nodeDesc, msgExecSvc, log);
    System.err.println("Started");
    System.err.flush();
    System.setOut(new PrintStream(out));
    System.setErr(new PrintStream(err));
}
Also used : PrintStream(java.io.PrintStream) ExecutorService(java.util.concurrent.ExecutorService) JdkMarshaller(org.apache.ignite.marshaller.jdk.JdkMarshaller) HadoopExternalCommunication(org.apache.ignite.internal.processors.hadoop.taskexecutor.external.communication.HadoopExternalCommunication) HadoopProcessDescriptor(org.apache.ignite.internal.processors.hadoop.taskexecutor.external.HadoopProcessDescriptor) IgniteLogger(org.apache.ignite.IgniteLogger) File(java.io.File)

Example 2 with JdkMarshaller

use of org.apache.ignite.marshaller.jdk.JdkMarshaller in project ignite by apache.

the class HadoopSortingExternalTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    cfg.setMarshaller(new JdkMarshaller());
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) JdkMarshaller(org.apache.ignite.marshaller.jdk.JdkMarshaller)

Example 3 with JdkMarshaller

use of org.apache.ignite.marshaller.jdk.JdkMarshaller in project ignite by apache.

the class IgniteH2Indexing method start.

/** {@inheritDoc} */
@SuppressWarnings("NonThreadSafeLazyInitialization")
@Override
public void start(GridKernalContext ctx, GridSpinBusyLock busyLock) throws IgniteCheckedException {
    if (log.isDebugEnabled())
        log.debug("Starting cache query index...");
    this.busyLock = busyLock;
    qryIdGen = new AtomicLong();
    if (SysProperties.serializeJavaObject) {
        U.warn(log, "Serialization of Java objects in H2 was enabled.");
        SysProperties.serializeJavaObject = false;
    }
    String dbName = (ctx != null ? ctx.localNodeId() : UUID.randomUUID()).toString();
    dbUrl = "jdbc:h2:mem:" + dbName + DB_OPTIONS;
    org.h2.Driver.load();
    try {
        if (getString(IGNITE_H2_DEBUG_CONSOLE) != null) {
            Connection c = DriverManager.getConnection(dbUrl);
            int port = getInteger(IGNITE_H2_DEBUG_CONSOLE_PORT, 0);
            WebServer webSrv = new WebServer();
            Server web = new Server(webSrv, "-webPort", Integer.toString(port));
            web.start();
            String url = webSrv.addSession(c);
            U.quietAndInfo(log, "H2 debug console URL: " + url);
            try {
                Server.openBrowser(url);
            } catch (Exception e) {
                U.warn(log, "Failed to open browser: " + e.getMessage());
            }
        }
    } catch (SQLException e) {
        throw new IgniteCheckedException(e);
    }
    if (ctx == null) {
        // This is allowed in some tests.
        nodeId = UUID.randomUUID();
        marshaller = new JdkMarshaller();
    } else {
        this.ctx = ctx;
        schemas.put(QueryUtils.DFLT_SCHEMA, new H2Schema(QueryUtils.DFLT_SCHEMA));
        valCtx = new CacheQueryObjectValueContext(ctx);
        nodeId = ctx.localNodeId();
        marshaller = ctx.config().getMarshaller();
        mapQryExec = new GridMapQueryExecutor(busyLock);
        rdcQryExec = new GridReduceQueryExecutor(qryIdGen, busyLock);
        mapQryExec.start(ctx, this);
        rdcQryExec.start(ctx, this);
        stmtCacheCleanupTask = ctx.timeout().schedule(new Runnable() {

            @Override
            public void run() {
                cleanupStatementCache();
            }
        }, CLEANUP_STMT_CACHE_PERIOD, CLEANUP_STMT_CACHE_PERIOD);
        dmlProc = new DmlStatementsProcessor();
        ddlProc = new DdlStatementsProcessor();
        dmlProc.start(ctx, this);
        ddlProc.start(ctx, this);
    }
    if (JdbcUtils.serializer != null)
        U.warn(log, "Custom H2 serialization is already configured, will override.");
    JdbcUtils.serializer = h2Serializer();
// TODO https://issues.apache.org/jira/browse/IGNITE-2139
// registerMBean(igniteInstanceName, this, GridH2IndexingSpiMBean.class);
}
Also used : WebServer(org.h2.server.web.WebServer) Server(org.h2.tools.Server) SQLException(java.sql.SQLException) IgniteSQLException(org.apache.ignite.internal.processors.query.IgniteSQLException) Connection(java.sql.Connection) IgniteSystemProperties.getString(org.apache.ignite.IgniteSystemProperties.getString) QueryCancelledException(org.apache.ignite.cache.query.QueryCancelledException) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) SQLException(java.sql.SQLException) IgniteException(org.apache.ignite.IgniteException) GridCacheEntryRemovedException(org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException) CacheException(javax.cache.CacheException) IgniteSQLException(org.apache.ignite.internal.processors.query.IgniteSQLException) GridMapQueryExecutor(org.apache.ignite.internal.processors.query.h2.twostep.GridMapQueryExecutor) AtomicLong(java.util.concurrent.atomic.AtomicLong) DdlStatementsProcessor(org.apache.ignite.internal.processors.query.h2.ddl.DdlStatementsProcessor) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) WebServer(org.h2.server.web.WebServer) GridPlainRunnable(org.apache.ignite.internal.util.lang.GridPlainRunnable) JdkMarshaller(org.apache.ignite.marshaller.jdk.JdkMarshaller) CacheQueryObjectValueContext(org.apache.ignite.internal.processors.query.CacheQueryObjectValueContext) GridReduceQueryExecutor(org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor)

Example 4 with JdkMarshaller

use of org.apache.ignite.marshaller.jdk.JdkMarshaller in project ignite by apache.

the class TcpClientDiscoveryMarshallerCheckSelfTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    if (igniteInstanceName.endsWith("0"))
        cfg.setMarshaller(new JdkMarshaller());
    else {
        cfg.setClientMode(true);
        cfg.setMarshaller(new BinaryMarshaller());
    }
    cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(ipFinder));
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) JdkMarshaller(org.apache.ignite.marshaller.jdk.JdkMarshaller)

Example 5 with JdkMarshaller

use of org.apache.ignite.marshaller.jdk.JdkMarshaller in project ignite by apache.

the class TcpDiscoveryMarshallerCheckSelfTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
    discoSpi.setIpFinder(ipFinder);
    cfg.setDiscoverySpi(discoSpi);
    cfg.setLocalHost("127.0.0.1");
    if (flag)
        cfg.setMarshaller(new JdkMarshaller());
    else
        cfg.setMarshaller(sameMarsh ? new JdkMarshaller() : new BinaryMarshaller());
    // Flip flag.
    flag = !flag;
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) JdkMarshaller(org.apache.ignite.marshaller.jdk.JdkMarshaller)

Aggregations

JdkMarshaller (org.apache.ignite.marshaller.jdk.JdkMarshaller)14 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)7 BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)4 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)3 IgniteLogger (org.apache.ignite.IgniteLogger)2 HadoopExternalCommunication (org.apache.ignite.internal.processors.hadoop.taskexecutor.external.communication.HadoopExternalCommunication)2 Marshaller (org.apache.ignite.marshaller.Marshaller)2 TcpCommunicationSpi (org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi)2 File (java.io.File)1 PrintStream (java.io.PrintStream)1 Connection (java.sql.Connection)1 SQLException (java.sql.SQLException)1 ArrayList (java.util.ArrayList)1 UUID (java.util.UUID)1 ExecutorService (java.util.concurrent.ExecutorService)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 CacheException (javax.cache.CacheException)1 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 IgniteException (org.apache.ignite.IgniteException)1 IgniteSystemProperties.getString (org.apache.ignite.IgniteSystemProperties.getString)1