当前位置: 首页>>代码示例>>Java>>正文


Java WrappedRunnable类代码示例

本文整理汇总了Java中org.apache.cassandra.utils.WrappedRunnable的典型用法代码示例。如果您正苦于以下问题:Java WrappedRunnable类的具体用法?Java WrappedRunnable怎么用?Java WrappedRunnable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


WrappedRunnable类属于org.apache.cassandra.utils包,在下文中一共展示了WrappedRunnable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: PropertyFileSnitch

import org.apache.cassandra.utils.WrappedRunnable; //导入依赖的package包/类
public PropertyFileSnitch() throws ConfigurationException
{
    reloadConfiguration();

    try
    {
        FBUtilities.resourceToFile(SNITCH_PROPERTIES_FILENAME);
        Runnable runnable = new WrappedRunnable()
        {
            protected void runMayThrow() throws ConfigurationException
            {
                reloadConfiguration();
            }
        };
        ResourceWatcher.watch(SNITCH_PROPERTIES_FILENAME, runnable, 60 * 1000);
    }
    catch (ConfigurationException ex)
    {
        logger.error("{} found, but does not look like a plain file. Will not watch it for changes", SNITCH_PROPERTIES_FILENAME);
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:22,代码来源:PropertyFileSnitch.java

示例2: announce

import org.apache.cassandra.utils.WrappedRunnable; //导入依赖的package包/类
private static Future<?> announce(final Collection<Mutation> schema)
{
    Future<?> f = StageManager.getStage(Stage.MIGRATION).submit(new WrappedRunnable()
    {
        protected void runMayThrow() throws IOException, ConfigurationException
        {
            DefsTables.mergeSchema(schema);
        }
    });

    for (InetAddress endpoint : Gossiper.instance.getLiveMembers())
    {
        // only push schema to nodes with known and equal versions
        if (!endpoint.equals(FBUtilities.getBroadcastAddress()) &&
                MessagingService.instance().knowsVersion(endpoint) &&
                MessagingService.instance().getRawVersion(endpoint) == MessagingService.current_version)
            pushSchemaMutation(endpoint, schema);
    }

    return f;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:22,代码来源:MigrationManager.java

示例3: maybeArchive

import org.apache.cassandra.utils.WrappedRunnable; //导入依赖的package包/类
public void maybeArchive(final CommitLogSegment segment)
{
    if (Strings.isNullOrEmpty(archiveCommand))
        return;

    archivePending.put(segment.getName(), executor.submit(new WrappedRunnable()
    {
        protected void runMayThrow() throws IOException
        {
            segment.waitForFinalSync();
            String command = archiveCommand.replace("%name", segment.getName());
            command = command.replace("%path", segment.getPath());
            exec(command);
        }
    }));
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:17,代码来源:CommitLogArchiver.java

示例4: start

import org.apache.cassandra.utils.WrappedRunnable; //导入依赖的package包/类
public void start()
{
    MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    try
    {
        mbs.registerMBean(this, new ObjectName(MBEAN_NAME));
    }
    catch (Exception e)
    {
        throw new RuntimeException(e);
    }

    Runnable runnable = new WrappedRunnable()
    {
        public void runMayThrow() throws ExecutionException, InterruptedException
        {
            replayAllFailedBatches();
        }
    };

    batchlogTasks.scheduleWithFixedDelay(runnable, StorageService.RING_DELAY, REPLAY_INTERVAL, TimeUnit.MILLISECONDS);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:23,代码来源:BatchlogManager.java

示例5: trace

import org.apache.cassandra.utils.WrappedRunnable; //导入依赖的package包/类
public static void trace(final ByteBuffer sessionIdBytes, final String message, final int elapsed)
{
    final String threadName = Thread.currentThread().getName();

    StageManager.getStage(Stage.TRACING).execute(new WrappedRunnable()
    {
        public void runMayThrow()
        {
            Mutation mutation = new Mutation(Tracing.TRACE_KS, sessionIdBytes);
            ColumnFamily cells = mutation.addOrGet(CFMetaData.TraceEventsCf);

            CFRowAdder adder = new CFRowAdder(cells, cells.metadata().comparator.make(UUIDGen.getTimeUUID()), FBUtilities.timestampMicros());
            adder.add("activity", message);
            adder.add("source", FBUtilities.getBroadcastAddress());
            if (elapsed >= 0)
                adder.add("source_elapsed", elapsed);
            adder.add("thread", threadName);

            Tracing.mutateWithCatch(mutation);
        }
    });
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:23,代码来源:TraceState.java

示例6: PropertyFileSnitch

import org.apache.cassandra.utils.WrappedRunnable; //导入依赖的package包/类
public PropertyFileSnitch() throws ConfigurationException
{
    reloadConfiguration();

    try
    {
        FBUtilities.resourceToFile(SNITCH_PROPERTIES_FILENAME);
        Runnable runnable = new WrappedRunnable()
        {
            protected void runMayThrow() throws ConfigurationException
            {
                reloadConfiguration();
            }
        };
        ResourceWatcher.watch(SNITCH_PROPERTIES_FILENAME, runnable, 60 * 1000);
    }
    catch (ConfigurationException ex)
    {
        logger.debug(SNITCH_PROPERTIES_FILENAME + " found, but does not look like a plain file. Will not watch it for changes");
    }
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:22,代码来源:PropertyFileSnitch.java

示例7: announce

import org.apache.cassandra.utils.WrappedRunnable; //导入依赖的package包/类
private static Future<?> announce(final Collection<RowMutation> schema)
{
    Future<?> f = StageManager.getStage(Stage.MIGRATION).submit(new WrappedRunnable()
    {
        protected void runMayThrow() throws IOException, ConfigurationException
        {
            DefsTables.mergeSchema(schema);
        }
    });

    for (InetAddress endpoint : Gossiper.instance.getLiveMembers())
    {
        if (endpoint.equals(FBUtilities.getBroadcastAddress()))
            continue; // we've dealt with localhost already

        // don't send schema to the nodes with the versions older than current major
        if (MessagingService.instance().getVersion(endpoint) < MessagingService.current_version)
            continue;

        pushSchemaMutation(endpoint, schema);
    }
    return f;
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:24,代码来源:MigrationManager.java

示例8: BatchCommitLogExecutorService

import org.apache.cassandra.utils.WrappedRunnable; //导入依赖的package包/类
public BatchCommitLogExecutorService(int queueSize)
{
    queue = new LinkedBlockingQueue<CheaterFutureTask>(queueSize);
    Runnable runnable = new WrappedRunnable()
    {
        public void runMayThrow() throws Exception
        {
            while (run)
            {
                if (processWithSyncBatch())
                    completedTaskCount++;
            }
        }
    };
    appendingThread = new Thread(runnable, "COMMIT-LOG-WRITER");
    appendingThread.start();

}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:19,代码来源:BatchCommitLogExecutorService.java

示例9: PropertyFileSnitch

import org.apache.cassandra.utils.WrappedRunnable; //导入依赖的package包/类
public PropertyFileSnitch(int refreshPeriodInSeconds) throws ConfigurationException
{
    reloadConfiguration(false);

    try
    {
        FBUtilities.resourceToFile(SNITCH_PROPERTIES_FILENAME);
        Runnable runnable = new WrappedRunnable()
        {
            protected void runMayThrow() throws ConfigurationException
            {
                reloadConfiguration(true);
            }
        };
        ResourceWatcher.watch(SNITCH_PROPERTIES_FILENAME, runnable, refreshPeriodInSeconds * 1000);
    }
    catch (ConfigurationException ex)
    {
        logger.error("{} found, but does not look like a plain file. Will not watch it for changes", SNITCH_PROPERTIES_FILENAME);
    }
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:22,代码来源:PropertyFileSnitch.java

示例10: announce

import org.apache.cassandra.utils.WrappedRunnable; //导入依赖的package包/类
private static Future<?> announce(final Collection<Mutation> schema)
{
    Future<?> f = StageManager.getStage(Stage.MIGRATION).submit(new WrappedRunnable()
    {
        protected void runMayThrow() throws ConfigurationException
        {
            SchemaKeyspace.mergeSchemaAndAnnounceVersion(schema);
        }
    });

    for (InetAddress endpoint : Gossiper.instance.getLiveMembers())
    {
        // only push schema to nodes with known and equal versions
        if (!endpoint.equals(FBUtilities.getBroadcastAddress()) &&
                MessagingService.instance().knowsVersion(endpoint) &&
                MessagingService.instance().getRawVersion(endpoint) == MessagingService.current_version)
            pushSchemaMutation(endpoint, schema);
    }

    return f;
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:22,代码来源:MigrationManager.java

示例11: testEmptyRow

import org.apache.cassandra.utils.WrappedRunnable; //导入依赖的package包/类
@Test
public void testEmptyRow() throws Exception
{
    Keyspace keyspace = Keyspace.open(KEYSPACE1);
    final ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF_STANDARD2);

    RowUpdateBuilder.deleteRow(cfs.metadata, FBUtilities.timestampMicros(), "key1", "Column1").applyUnsafe();

    Runnable r = new WrappedRunnable()
    {
        public void runMayThrow() throws IOException
        {
            Row toCheck = Util.getOnlyRowUnfiltered(Util.cmd(cfs, "key1").build());
            Iterator<Cell> iter = toCheck.cells().iterator();
            assert(Iterators.size(iter) == 0);
        }
    };

    reTest(cfs, r);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:21,代码来源:ColumnFamilyStoreTest.java

示例12: submitMaximal

import org.apache.cassandra.utils.WrappedRunnable; //导入依赖的package包/类
public Future<?> submitMaximal(final ColumnFamilyStore cfStore, final int gcBefore)
{
    // here we compute the task off the compaction executor, so having that present doesn't
    // confuse runWithCompactionsDisabled -- i.e., we don't want to deadlock ourselves, waiting
    // for ourselves to finish/acknowledge cancellation before continuing.
    final Collection<AbstractCompactionTask> tasks = cfStore.getCompactionStrategy().getMaximalTask(gcBefore);
    Runnable runnable = new WrappedRunnable()
    {
        protected void runMayThrow() throws IOException
        {
            if (tasks == null)
                return;
            for (AbstractCompactionTask task : tasks)
                task.execute(metrics);
        }
    };
    return executor.submit(runnable);
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:19,代码来源:CompactionManager.java

示例13: trace

import org.apache.cassandra.utils.WrappedRunnable; //导入依赖的package包/类
public static void trace(final ByteBuffer sessionIdBytes, final String message, final int elapsed)
{
    final ByteBuffer eventId = ByteBuffer.wrap(UUIDGen.getTimeUUIDBytes());
    final String threadName = Thread.currentThread().getName();

    StageManager.getStage(Stage.TRACING).execute(new WrappedRunnable()
    {
        public void runMayThrow()
        {
            CFMetaData cfMeta = CFMetaData.TraceEventsCf;
            ColumnFamily cf = ArrayBackedSortedColumns.factory.create(cfMeta);
            Tracing.addColumn(cf, Tracing.buildName(cfMeta, eventId, ByteBufferUtil.bytes("activity")), message);
            Tracing.addColumn(cf, Tracing.buildName(cfMeta, eventId, ByteBufferUtil.bytes("source")), FBUtilities.getBroadcastAddress());
            if (elapsed >= 0)
                Tracing.addColumn(cf, Tracing.buildName(cfMeta, eventId, ByteBufferUtil.bytes("source_elapsed")), elapsed);
            Tracing.addColumn(cf, Tracing.buildName(cfMeta, eventId, ByteBufferUtil.bytes("thread")), threadName);
            Tracing.mutateWithCatch(new Mutation(Tracing.TRACE_KS, sessionIdBytes, cf));
        }
    });
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:21,代码来源:TraceState.java

示例14: announce

import org.apache.cassandra.utils.WrappedRunnable; //导入依赖的package包/类
private static Future<?> announce(final Collection<RowMutation> schema)
{
    Future<?> f = StageManager.getStage(Stage.MIGRATION).submit(new WrappedRunnable()
    {
        protected void runMayThrow() throws IOException, ConfigurationException
        {
            DefsTable.mergeSchema(schema);
        }
    });

    for (InetAddress endpoint : Gossiper.instance.getLiveMembers())
    {
        if (endpoint.equals(FBUtilities.getBroadcastAddress()))
            continue; // we've dealt with localhost already

        // don't send schema to the nodes with the versions older than current major
        if (MessagingService.instance().getVersion(endpoint) < MessagingService.current_version)
            continue;

        pushSchemaMutation(endpoint, schema);
    }
    return f;
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:24,代码来源:MigrationManager.java

示例15: start

import org.apache.cassandra.utils.WrappedRunnable; //导入依赖的package包/类
public void start()
{
    MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    try
    {
        mbs.registerMBean(this, new ObjectName(MBEAN_NAME));
    }
    catch (Exception e)
    {
        throw new RuntimeException(e);
    }

    Runnable runnable = new WrappedRunnable()
    {
        public void runMayThrow() throws ExecutionException, InterruptedException
        {
            replayAllFailedBatches();
        }
    };
    StorageService.optionalTasks.scheduleWithFixedDelay(runnable, StorageService.RING_DELAY, REPLAY_INTERVAL, TimeUnit.MILLISECONDS);
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:22,代码来源:BatchlogManager.java


注:本文中的org.apache.cassandra.utils.WrappedRunnable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。