Search in sources :

Example 11 with NullLogger

use of org.apache.ignite.logger.NullLogger in project ignite by apache.

the class GridCacheUtilsSelfTest method binaryMarshaller.

/**
 * @return Binary marshaller.
 * @throws IgniteCheckedException if failed.
 */
private BinaryMarshaller binaryMarshaller() throws IgniteCheckedException {
    IgniteConfiguration iCfg = new IgniteConfiguration();
    BinaryConfiguration bCfg = new BinaryConfiguration();
    iCfg.setBinaryConfiguration(bCfg);
    BinaryContext ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), iCfg, new NullLogger());
    BinaryMarshaller marsh = new BinaryMarshaller();
    marsh.setContext(new MarshallerContextTestImpl(null));
    IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, iCfg);
    return marsh;
}
Also used : NullLogger(org.apache.ignite.logger.NullLogger) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryConfiguration(org.apache.ignite.configuration.BinaryConfiguration) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) GridBinaryMarshaller(org.apache.ignite.internal.binary.GridBinaryMarshaller) BinaryContext(org.apache.ignite.internal.binary.BinaryContext) MarshallerContextTestImpl(org.apache.ignite.marshaller.MarshallerContextTestImpl)

Example 12 with NullLogger

use of org.apache.ignite.logger.NullLogger in project ignite by apache.

the class GridH2IndexBase method initDistributedJoinMessaging.

/**
 * @param tbl Table.
 */
protected final void initDistributedJoinMessaging(GridH2Table tbl) {
    final GridH2RowDescriptor desc = tbl.rowDescriptor();
    if (desc != null && desc.context() != null) {
        ctx = desc.context();
        GridKernalContext ctx = desc.context().kernalContext();
        log = ctx.log(getClass());
        msgTopic = new IgniteBiTuple<>(GridTopic.TOPIC_QUERY, tbl.identifierString() + '.' + getName());
        msgLsnr = new GridMessageListener() {

            @Override
            public void onMessage(UUID nodeId, Object msg, byte plc) {
                GridSpinBusyLock l = desc.indexing().busyLock();
                if (!l.enterBusy())
                    return;
                try {
                    onMessage0(nodeId, msg);
                } finally {
                    l.leaveBusy();
                }
            }
        };
        ctx.io().addMessageListener(msgTopic, msgLsnr);
    } else {
        msgTopic = null;
        msgLsnr = null;
        log = new NullLogger();
    }
}
Also used : GridSpinBusyLock(org.apache.ignite.internal.util.GridSpinBusyLock) NullLogger(org.apache.ignite.logger.NullLogger) GridKernalContext(org.apache.ignite.internal.GridKernalContext) GridMessageListener(org.apache.ignite.internal.managers.communication.GridMessageListener) CacheObject(org.apache.ignite.internal.processors.cache.CacheObject) UUID(java.util.UUID)

Example 13 with NullLogger

use of org.apache.ignite.logger.NullLogger in project ignite by apache.

the class IgniteWalConverter method main.

/**
 * @param args Args.
 */
public static void main(String[] args) throws Exception {
    if (args.length < 2)
        throw new IllegalArgumentException("\nYou need to provide:\n" + "\t1. Size of pages, which was selected for file store (1024, 2048, 4096, etc).\n" + "\t2. Path to dir with wal files.\n" + "\t3. (Optional) Path to dir with archive wal files.");
    PageIO.registerH2(H2InnerIO.VERSIONS, H2LeafIO.VERSIONS);
    H2ExtrasInnerIO.register();
    H2ExtrasLeafIO.register();
    boolean printRecords = IgniteSystemProperties.getBoolean("PRINT_RECORDS", false);
    boolean printStat = IgniteSystemProperties.getBoolean("PRINT_STAT", true);
    final IgniteWalIteratorFactory factory = new IgniteWalIteratorFactory(new NullLogger(), Integer.parseInt(args[0]), null, null, false);
    final File walWorkDirWithConsistentId = new File(args[1]);
    final File[] workFiles = walWorkDirWithConsistentId.listFiles(FileWriteAheadLogManager.WAL_SEGMENT_FILE_FILTER);
    if (workFiles == null)
        throw new IllegalArgumentException("No .wal files in dir: " + args[1]);
    @Nullable final WalStat stat = printStat ? new WalStat() : null;
    try (WALIterator stIt = factory.iteratorWorkFiles(workFiles)) {
        while (stIt.hasNextX()) {
            IgniteBiTuple<WALPointer, WALRecord> next = stIt.nextX();
            final WALPointer pointer = next.get1();
            final WALRecord record = next.get2();
            if (stat != null)
                stat.registerRecord(record, pointer, true);
            if (printRecords)
                System.out.println("[W] " + record);
        }
    }
    if (args.length >= 3) {
        final File walArchiveDirWithConsistentId = new File(args[2]);
        try (WALIterator stIt = factory.iteratorArchiveDirectory(walArchiveDirWithConsistentId)) {
            while (stIt.hasNextX()) {
                IgniteBiTuple<WALPointer, WALRecord> next = stIt.nextX();
                final WALPointer pointer = next.get1();
                final WALRecord record = next.get2();
                if (stat != null)
                    stat.registerRecord(record, pointer, false);
                if (printRecords)
                    System.out.println("[A] " + record);
            }
        }
    }
    System.err.flush();
    if (stat != null)
        System.out.println("Statistic collected:\n" + stat.toString());
}
Also used : IgniteWalIteratorFactory(org.apache.ignite.internal.processors.cache.persistence.wal.reader.IgniteWalIteratorFactory) WALRecord(org.apache.ignite.internal.pagemem.wal.record.WALRecord) NullLogger(org.apache.ignite.logger.NullLogger) WALIterator(org.apache.ignite.internal.pagemem.wal.WALIterator) File(java.io.File) WALPointer(org.apache.ignite.internal.pagemem.wal.WALPointer) Nullable(org.jetbrains.annotations.Nullable)

Example 14 with NullLogger

use of org.apache.ignite.logger.NullLogger in project ignite by apache.

the class JdbcThinConnection method createBinaryCtx.

/**
 * Create new binary context.
 */
private BinaryContext createBinaryCtx(JdbcBinaryMetadataHandler metaHnd, JdbcMarshallerContext marshCtx) {
    BinaryMarshaller marsh = new BinaryMarshaller();
    marsh.setContext(marshCtx);
    BinaryConfiguration binCfg = new BinaryConfiguration().setCompactFooter(true);
    BinaryContext ctx = new BinaryContext(metaHnd, new IgniteConfiguration(), new NullLogger());
    ctx.configure(marsh, binCfg);
    ctx.registerUserTypesSchema();
    return ctx;
}
Also used : NullLogger(org.apache.ignite.logger.NullLogger) BinaryConfiguration(org.apache.ignite.configuration.BinaryConfiguration) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) BinaryContext(org.apache.ignite.internal.binary.BinaryContext)

Example 15 with NullLogger

use of org.apache.ignite.logger.NullLogger in project ignite by apache.

the class JmhStreamerAddDataBenchmark method getConfiguration.

/**
 * Create Ignite configuration.
 *
 * @return Ignite configuration.
 */
private IgniteConfiguration getConfiguration(String cfgName, boolean isClient) {
    IgniteConfiguration cfg = new IgniteConfiguration();
    cfg.setGridLogger(new NullLogger());
    cfg.setIgniteInstanceName(cfgName);
    if (isClient) {
        cfg.setClientMode(true);
        cfg.setCacheConfiguration(defaultCacheConfiguration(IGNITE_CLIENT_CACHE_NAME));
    } else
        cfg.setCacheConfiguration(defaultCacheConfiguration("server"));
    return cfg;
}
Also used : NullLogger(org.apache.ignite.logger.NullLogger) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration)

Aggregations

NullLogger (org.apache.ignite.logger.NullLogger)23 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)17 BinaryContext (org.apache.ignite.internal.binary.BinaryContext)10 BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)10 MarshallerContextTestImpl (org.apache.ignite.marshaller.MarshallerContextTestImpl)10 BinaryConfiguration (org.apache.ignite.configuration.BinaryConfiguration)8 Test (org.junit.Test)6 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)4 IgniteException (org.apache.ignite.IgniteException)4 GridBinaryMarshaller (org.apache.ignite.internal.binary.GridBinaryMarshaller)4 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)4 Ignite (org.apache.ignite.Ignite)3 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)3 File (java.io.File)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 BinaryTypeConfiguration (org.apache.ignite.binary.BinaryTypeConfiguration)2 GridDiscoveryManager (org.apache.ignite.internal.managers.discovery.GridDiscoveryManager)2 GridSystemViewManager (org.apache.ignite.internal.managers.systemview.GridSystemViewManager)2 JmxSystemViewExporterSpi (org.apache.ignite.internal.managers.systemview.JmxSystemViewExporterSpi)2 WALIterator (org.apache.ignite.internal.pagemem.wal.WALIterator)2