我正在尝试mdc登录java中的播放过滤器我在scala中遵循本教程的所有请求并尝试转换为java http://yanns.github.io/blog/2014/05/04/slf4j-mapped-diagnostic-context- MDC-与播放的框架/
但仍然没有将mdc传播到所有执行上下文.我使用此调度程序作为默认调度程序,但它有许多执行上下文.我需要将mdc传播到所有执行上下文
下面是我的java代码
import java.util.Map;
import org.slf4j.MDC;
import scala.concurrent.ExecutionContext;
import scala.concurrent.duration.Duration;
import scala.concurrent.duration.FiniteDuration;
import akka.dispatch.Dispatcher;
import akka.dispatch.ExecutorServiceFactoryProvider;
import akka.dispatch.MessageDispatcherConfigurator;
public class MDCPropagatingDispatcher extends Dispatcher {
public MDCPropagatingDispatcher(
MessageDispatcherConfigurator _configurator, String id,
int throughput, Duration throughputDeadlineTime,
ExecutorServiceFactoryProvider executorServiceFactoryProvider,
FiniteDuration shutdownTimeout) {
super(_configurator, id, throughput, throughputDeadlineTime,
executorServiceFactoryProvider, shutdownTimeout);
}
@Override
public ExecutionContext prepare() {
final Map<String, String> mdcContext = MDC.getCopyOfContextMap();
return new ExecutionContext() {
@Override
public void execute(Runnable r) {
Map<String, String> oldMDCContext = MDC.getCopyOfContextMap();
setContextMap(mdcContext);
try {
r.run();
} …
Run Code Online (Sandbox Code Playgroud) 我使用的是rails_admin和paperclip,但是使用带有回形针属性的模型安装rails_admin has_attached_file
会引发错误
undefined method `attachment_definitions'
Run Code Online (Sandbox Code Playgroud)
我在主git分支和受保护的属性gem中使用Rails 4和rails_admin.
当我尝试创建一个github问题时,它会给出消息未找到回复.以及如何使用此发送身份验证标头.因为创建问题需要用户登录或验证
curl -X POST -i -d'{"title":"my-new-repo","body":"我的新问题描述"}' https://api.github.com/repos/barterli/barter.李/问题
HTTP/1.1 404 Not Found
Server: GitHub.com
Date: Wed, 19 Feb 2014 07:11:33 GMT
Content-Type: application/json; charset=utf-8
Status: 404 Not Found
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 57
X-RateLimit-Reset: 1392797200
X-GitHub-Media-Type: github.beta
X-Content-Type-Options: nosniff
Content-Length: 86
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
Access-Control-Allow-Origin: *
X-GitHub-Request-Id: 6A33C772:4DE7:9FBE4E:53045924
{
"message": "Not Found",
"documentation_url": "http://developer.github.com/v3"
}
Run Code Online (Sandbox Code Playgroud)
还有如何使用github_api或octokit以红宝石的方式完成(因为我无法找到有关创建问题的文档)目前我所做的是使用github_api gem
issues = Github :: Issues.new用户:'user',repo:'repo'它发布到同一个网址(https://api.github.com/repos/repo/user/issues)并再次找不到网页错误.而且我也不知道如何用它发送身份验证
我们在android中实现了rabbitmq聊天.但是rabbitmq的java客户端是耗电的.对于android聊天,是不是很好用?我们使用直接交换个人队列的人和个人路由键.在rabbitmq中进行一对一聊天的最佳设计模式是什么?以及减少电池使用的方法