• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Processors类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: runtimeConfig

import de.flapdoodle.embed.process.io.Processors; //导入依赖的package包/类
private IRuntimeConfig runtimeConfig()
{
    FixedPath path = new FixedPath( "bin/" );
    IStreamProcessor mongodOutput;
    IStreamProcessor mongodError;
    IStreamProcessor commandsOutput;
    try
    {
        mongodOutput = Processors.named( "[mongod>]", new FileStreamProcessor( new File( logPath, "mongo.log" ) ) );

        mongodError = new FileStreamProcessor( new File( logPath, "mongo-err.log" ) );
        commandsOutput =
            Processors.named( "[mongod>]", new FileStreamProcessor( new File( logPath, "mongo.log" ) ) );
    }
    catch ( FileNotFoundException e )
    {
        throw Throwables.propagate( e );
    }
    return new RuntimeConfigBuilder().defaults( Command.MongoD )
        .processOutput( new ProcessOutput( mongodOutput, mongodError, commandsOutput ) )
        .artifactStore( new ArtifactStoreBuilder().downloader( new Downloader() )
            .executableNaming( new UserTempNaming() ).tempDir( path ).download(
                new DownloadConfigBuilder().defaultsForCommand( Command.MongoD ).artifactStorePath( path ) ) )
        .build();
}
 
开发者ID:cherimojava,项目名称:orchidae,代码行数:26,代码来源:cfgMongo.java


示例2: run

import de.flapdoodle.embed.process.io.Processors; //导入依赖的package包/类
void run(Process p, IRuntimeConfig runtimeConfig, long timeoutNanos) throws IOException {
    CollectingAndForwardingStreamProcessor wrapped =
            new CollectingAndForwardingStreamProcessor(runtimeConfig.getProcessOutput().getOutput());
    IStreamProcessor loggingWatch = StreamToLineProcessor.wrap(wrapped);

    try {
        ReaderProcessor processorOne = Processors.connect(new InputStreamReader(p.getInputStream()), loggingWatch);
        ReaderProcessor processorTwo = Processors.connect(new InputStreamReader(p.getErrorStream()), loggingWatch);

        int retCode = tope.waitFor(p, timeoutNanos);

        if (retCode != 0) {
            processorOne.join(10000);
            processorTwo.join(10000);
            resolveException(retCode, wrapped.getOutput());
        }

    } catch (InterruptedException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:wix,项目名称:wix-embedded-mysql,代码行数:22,代码来源:ProcessRunner.java


示例3: onAfterProcessStart

import de.flapdoodle.embed.process.io.Processors; //导入依赖的package包/类
@Override
public void onAfterProcessStart(final ProcessControl process, final IRuntimeConfig runtimeConfig) throws IOException {
    outputWatch = new NotifyingStreamProcessor(StreamToLineProcessor.wrap(runtimeConfig.getProcessOutput().getOutput()));
    Processors.connect(process.getReader(), outputWatch);
    Processors.connect(process.getError(), outputWatch);
    ResultMatchingListener startupListener = outputWatch.addListener(new ResultMatchingListener("ready for connections"));

    try {
        startupListener.waitForResult(getConfig().getTimeout(MILLISECONDS));

        if (!startupListener.isInitWithSuccess()) {
            throw new RuntimeException("mysql start failed with error: " + startupListener.getFailureFound());
        }
    } catch (Exception e) {
        // emit IO exception for {@link AbstractProcess} would try to stop running process gracefully
        throw new IOException(e);
    }
}
 
开发者ID:wix,项目名称:wix-embedded-mysql,代码行数:19,代码来源:MysqldProcess.java


示例4: embeddedMongoRuntimeConfig

import de.flapdoodle.embed.process.io.Processors; //导入依赖的package包/类
@Bean
public IRuntimeConfig embeddedMongoRuntimeConfig() {
	Logger logger = LoggerFactory
			.getLogger(getClass().getPackage().getName() + ".EmbeddedMongo");
	ProcessOutput processOutput = new ProcessOutput(
			Processors.logTo(logger, Slf4jLevel.INFO),
			Processors.logTo(logger, Slf4jLevel.ERROR), Processors.named(
					"[console>]", Processors.logTo(logger, Slf4jLevel.DEBUG)));
	return new RuntimeConfigBuilder().defaultsWithLogger(Command.MongoD, logger)
			.processOutput(processOutput).artifactStore(getArtifactStore(logger))
			.build();
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:13,代码来源:EmbeddedMongoAutoConfiguration.java


示例5: embeddedMongoRuntimeConfig

import de.flapdoodle.embed.process.io.Processors; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
@ConditionalOnClass(Logger.class)
public IRuntimeConfig embeddedMongoRuntimeConfig() {
	Logger logger = LoggerFactory
			.getLogger(getClass().getPackage().getName() + ".EmbeddedMongo");
	ProcessOutput processOutput = new ProcessOutput(
			Processors.logTo(logger, Slf4jLevel.INFO),
			Processors.logTo(logger, Slf4jLevel.ERROR), Processors.named("[console>]",
					Processors.logTo(logger, Slf4jLevel.DEBUG)));
	return new RuntimeConfigBuilder().defaultsWithLogger(Command.MongoD, logger)
			.processOutput(processOutput).artifactStore(getArtifactStore(logger))
			.build();
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:15,代码来源:EmbeddedMongoAutoConfiguration.java


示例6: initialize

import de.flapdoodle.embed.process.io.Processors; //导入依赖的package包/类
private void initialize() {
    if (db != null) {
        return;
    }

    System.setProperty("mongodb.database", dbName);
    System.setProperty("mongodb.host", mongoHostname);
    System.setProperty("mongodb.port", String.valueOf(mongoPort));

    try {
        IStreamProcessor mongodOutput = Processors.named("[mongod>]",
                new FileStreamProcessor(File.createTempFile("mongod", "log")));
        IStreamProcessor mongodError = new FileStreamProcessor(File.createTempFile("mongod-error", "log"));
        IStreamProcessor commandsOutput = Processors.namedConsole("[console>]");

        IRuntimeConfig runtimeConfig = new RuntimeConfigBuilder()
                .defaults(Command.MongoD)
                .processOutput(new ProcessOutput(mongodOutput, mongodError, commandsOutput))
                .build();

        MongodStarter runtime = MongodStarter.getInstance(runtimeConfig);
        mongodExe = runtime.prepare(
                new MongodConfigBuilder()
                .version(de.flapdoodle.embed.mongo.distribution.Version.V2_6_8)
                .net(new Net(mongoPort, Network.localhostIsIPv6()))
                .build()
        );
        try {
            mongod = mongodExe.start();
        } catch (Throwable t) {
            // try again, could be killed breakpoint in IDE
            mongod = mongodExe.start();
        }

        if (MONGO_CREDENTIALS.isEmpty()) {
            client = new MongoClient(mongoHostname + ":" + mongoPort);
        } else {
            client = new MongoClient(new ServerAddress(mongoHostname + ":" + mongoPort), MONGO_CREDENTIALS);
            client.getDB("admin").command("{ user: \"siteUserAdmin\", pwd: \"password\", roles: [ { role: \"userAdminAnyDatabase\", db: \"admin\" } , { role: \"userAdminAnyDatabase\", db: \"" + dbName + "\" } ] }");
        }

        Runtime.getRuntime().addShutdownHook(new Thread() {
            @Override
            public void run() {
                super.start();
                if (mongodExe != null) {
                    mongodExe.stop();
                }
                db = null;
                client = null;
                mongod = null;
                mongodExe = null;
            }

        });

        db = client.getDB(dbName);
    } catch (IOException e) {
        throw new Error(e);
    }
}
 
开发者ID:lightblue-platform,项目名称:lightblue-mongo,代码行数:62,代码来源:EmbeddedMongo.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ProblemActionHeader类代码示例发布时间:2022-05-23
下一篇:
Java MqttTopicSubscription类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap