![JAR search and dependency download from the Maven repository](/logo.png)
com.shedhack.thread.context.adapter.SimpleThreadContextAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of thread-context-handler Show documentation
Show all versions of thread-context-handler Show documentation
Context enabler, for helping with debugging/logging
package com.shedhack.thread.context.adapter;
import com.shedhack.thread.context.handler.SimpleThreadContextHandler;
import java.util.Date;
import java.util.Map;
/**
* @author imamchishty
*/
public class SimpleThreadContextAdapter implements ThreadContextAdapter {
public SimpleThreadContextAdapter(SimpleThreadContextHandler handler) {
this.handler = handler;
}
private SimpleThreadContextHandler handler;
private static final String TEXT = "{\"request-id\": \"%s\", \"timestamp\": \"%s\", " +
"\"method\": \"%s\", \"params\": \"%s\", \"context\": \"%s\"}";
/**
* {@inheritDoc}
*/
public void setContext(String id, Date date, String method, Map context, Map params) {
handler.setThreadContext(String.format(TEXT, id, date, method, params, context));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy