// Path: mappingrpc-connector/src/main/java/github/mappingrpc/core/constant/ClientDaemonThreadEventType.java
// public class ClientDaemonThreadEventType {
// 	public static final byte noEvent = 0;
// 
// 	@Deprecated
// 	public static final byte channelConnecting = 1;
// 
// 	@Deprecated
// 	public static final byte channelConnected = 2;
// 	public static final byte channelDisconnected = 3;
// 	public static final byte closeDaemonThread = 4;
// }


import github.mappingrpc.core.constant.ClientDaemonThreadEventType;
import java.util.List;
import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.TimeUnit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
package github.mappingrpc.core.event;




public class TimerAndEventDaemonThread extends Thread {
	static Logger log = LoggerFactory.getLogger(TimerAndEventDaemonThread.class);

	private volatile boolean toStop = false;
	private BlockingQueue<ClientDaemonThreadEvent> blockingQueue;
	private List<Runnable> timerJobList = new CopyOnWriteArrayList<Runnable>();
	private Map<Byte, Runnable> eventHandlerMap = new ConcurrentHashMap<Byte, Runnable>();

	public TimerAndEventDaemonThread(BlockingQueue<ClientDaemonThreadEvent> blockingQueue) {
		super("MappingPackageClient-Daemon");
		setDaemon(true);
		this.blockingQueue = blockingQueue;
	}

	public void close() {
		toStop = true;
// Path: mappingrpc-connector/src/main/java/github/mappingrpc/core/constant/ClientDaemonThreadEventType.java
// public class ClientDaemonThreadEventType {
// 	public static final byte noEvent = 0;
// 
// 	@Deprecated
// 	public static final byte channelConnecting = 1;
// 
// 	@Deprecated
// 	public static final byte channelConnected = 2;
// 	public static final byte channelDisconnected = 3;
// 	public static final byte closeDaemonThread = 4;
// }


// Path: mappingrpc-connector/src/main/java/github/mappingrpc/core/event/TimerAndEventDaemonThread.java
import github.mappingrpc.core.constant.ClientDaemonThreadEventType;
import java.util.List;
import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.TimeUnit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

package github.mappingrpc.core.event;




public class TimerAndEventDaemonThread extends Thread {
	static Logger log = LoggerFactory.getLogger(TimerAndEventDaemonThread.class);

	private volatile boolean toStop = false;
	private BlockingQueue<ClientDaemonThreadEvent> blockingQueue;
	private List<Runnable> timerJobList = new CopyOnWriteArrayList<Runnable>();
	private Map<Byte, Runnable> eventHandlerMap = new ConcurrentHashMap<Byte, Runnable>();

	public TimerAndEventDaemonThread(BlockingQueue<ClientDaemonThreadEvent> blockingQueue) {
		super("MappingPackageClient-Daemon");
		setDaemon(true);
		this.blockingQueue = blockingQueue;
	}

	public void close() {
		toStop = true;
		blockingQueue.offer(new ClientDaemonThreadEvent(ClientDaemonThreadEventType.closeDaemonThread));