/**
 * Copyright 2008-2009. Chongqing Communications Industry Services Co.,Ltd Information Technology Branch. All rights reserved. <a>http://www.crunii.com</a>
 */
package com.crunii.micro.domain.dto;

import com.alibaba.ttl.TransmittableThreadLocal;
import com.crunii.micro.common.utils.NanoIdUtil;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;

/**
 * @author 田平 create 2018年11月9日上午9:55:15
 */
@Getter
@Setter
@ToString
public class CallHolder implements Serializable {

	private static final long serialVersionUID = 1L;

	public static ThreadLocal<CallHolder> call = new TransmittableThreadLocal<>();

	public static CallHolder initialCall() {
		CallHolder callInfo = new CallHolder();
		callInfo.setCallSerial(NanoIdUtil.randomLowerNanoId());
		call.set(callInfo);
		return callInfo;
	}

	private Worker worker;
	private String callUrl;
	private String callSerial;
	/**
	 * 当前url是否需要记录操作日志
	 */
	private boolean needLog;

	/**
	 * CurrWorkerService.getCurrWorker(String token)
	 * 当前header中的token
	 */
	private String token;

}
