本文整理汇总了Java中org.jetbrains.jps.service.SharedThreadPool.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java SharedThreadPool.getInstance方法的具体用法?Java SharedThreadPool.getInstance怎么用?Java SharedThreadPool.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jetbrains.jps.service.SharedThreadPool
的用法示例。
在下文中一共展示了SharedThreadPool.getInstance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ExternalJavacProcess
import org.jetbrains.jps.service.SharedThreadPool; //导入方法依赖的package包/类
public ExternalJavacProcess() {
final JavacRemoteProto.Message msgDefaultInstance = JavacRemoteProto.Message.getDefaultInstance();
myEventLoopGroup = new NioEventLoopGroup(1, SharedThreadPool.getInstance());
myChannelInitializer = new ChannelInitializer() {
@Override
protected void initChannel(Channel channel) throws Exception {
channel.pipeline().addLast(new ProtobufVarint32FrameDecoder(),
new ProtobufDecoder(msgDefaultInstance),
new ProtobufVarint32LengthFieldPrepender(),
new ProtobufEncoder(),
new CompilationRequestsHandler()
);
}
};
}
示例2: JavacServer
import org.jetbrains.jps.service.SharedThreadPool; //导入方法依赖的package包/类
public JavacServer() {
myChannelFactory = new NioServerSocketChannelFactory(SharedThreadPool.getInstance(), SharedThreadPool.getInstance(), 1);
final ChannelRegistrar channelRegistrar = new ChannelRegistrar();
final ChannelHandler compilationRequestsHandler = new CompilationRequestsHandler();
myPipelineFactory = new ChannelPipelineFactory() {
public ChannelPipeline getPipeline() throws Exception {
return Channels.pipeline(
channelRegistrar,
new ProtobufVarint32FrameDecoder(),
new ProtobufDecoder(JavacRemoteProto.Message.getDefaultInstance()),
new ProtobufVarint32LengthFieldPrepender(),
new ProtobufEncoder(),
compilationRequestsHandler
);
}
};
}
示例3: JavacServerClient
import org.jetbrains.jps.service.SharedThreadPool; //导入方法依赖的package包/类
public JavacServerClient() {
super(JavacRemoteProto.Message.getDefaultInstance(), SharedThreadPool.getInstance(), new UUIDGetter() {
@NotNull
public UUID getSessionUUID(@NotNull MessageEvent e) {
final JavacRemoteProto.Message message = (JavacRemoteProto.Message)e.getMessage();
final JavacRemoteProto.Message.UUID uuid = message.getSessionId();
return new UUID(uuid.getMostSigBits(), uuid.getLeastSigBits());
}
});
}
示例4: EventsProcessor
import org.jetbrains.jps.service.SharedThreadPool; //导入方法依赖的package包/类
EventsProcessor() {
super(SharedThreadPool.getInstance());
}
示例5: main
import org.jetbrains.jps.service.SharedThreadPool; //导入方法依赖的package包/类
public static void main(String[] args){
System.out.println("Build process started. Classpath: " + System.getProperty("java.class.path"));
final String host = args[0];
final int port = Integer.parseInt(args[1]);
final UUID sessionId = UUID.fromString(args[2]);
final File systemDir = new File(FileUtil.toCanonicalPath(args[3]));
Utils.setSystemRoot(systemDir);
ourChannelFactory = new NioClientSocketChannelFactory(SharedThreadPool.getInstance(), SharedThreadPool.getInstance(), 1);
final ClientBootstrap bootstrap = new ClientBootstrap(ourChannelFactory);
bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
public ChannelPipeline getPipeline() throws Exception {
return Channels.pipeline(
new ProtobufVarint32FrameDecoder(),
new ProtobufDecoder(CmdlineRemoteProto.Message.getDefaultInstance()),
new ProtobufVarint32LengthFieldPrepender(),
new ProtobufEncoder(),
new MyMessageHandler(sessionId)
);
}
});
bootstrap.setOption("tcpNoDelay", true);
bootstrap.setOption("keepAlive", true);
final ChannelFuture future = bootstrap.connect(new InetSocketAddress(host, port));
future.awaitUninterruptibly();
final boolean success = future.isSuccess();
if (success) {
Channels.write(future.getChannel(), CmdlineProtoUtil.toMessage(sessionId, CmdlineProtoUtil.createParamRequest()));
}
else {
final Throwable reason = future.getCause();
System.err.println("Error connecting to " + host + ":" + port + "; reason: " + (reason != null? reason.getMessage() : "unknown"));
if (reason != null) {
reason.printStackTrace(System.err);
}
System.err.println("Exiting.");
System.exit(-1);
}
}