// Path: uncode-dal/src/main/java/cn/uncode/dal/asyn/Method.java
// public enum Method {
// 	
// 	SELECT_BY_CRITERIA(1),
// 	
// 	COUNT_BY_CRITERIA(5),
// 	
// 	SELECT_BY_PRIMARY_KEY(6),
// 	
// 	UPDATE(7),
// 	
// 	DELETE(8),
// 	
// 	INSERT(2), INSERT_TABLE(3), INSERT_DATABASE_TABLE(4);
// 
// 	public final int type;
// 
// 	Method(int type) {
// 		this.type = type;
// 	}
// 
// }


import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import cn.uncode.dal.asyn.Method;
package cn.uncode.dal.event;



/**
 * 
 * @author juny.ye

 */
public class EventObservable {

	private Lock lock = new ReentrantLock(true);

	private List<EventListener> listeners = new ArrayList<EventListener>();

	public void addListener(EventListener listener) {
		lock.lock();
		try {
			if (listener != null)
				listeners.add(listener);
		} finally {
			lock.unlock();
		}
	}

	public void deleteListener(EventListener listener) {
		lock.lock();
		try {
			if (listener != null)
				listeners.remove(listener);
		} finally {
			lock.unlock();
		}
	}

// Path: uncode-dal/src/main/java/cn/uncode/dal/asyn/Method.java
// public enum Method {
// 	
// 	SELECT_BY_CRITERIA(1),
// 	
// 	COUNT_BY_CRITERIA(5),
// 	
// 	SELECT_BY_PRIMARY_KEY(6),
// 	
// 	UPDATE(7),
// 	
// 	DELETE(8),
// 	
// 	INSERT(2), INSERT_TABLE(3), INSERT_DATABASE_TABLE(4);
// 
// 	public final int type;
// 
// 	Method(int type) {
// 		this.type = type;
// 	}
// 
// }


// Path: uncode-dal/src/main/java/cn/uncode/dal/event/EventObservable.java
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import cn.uncode.dal.asyn.Method;

package cn.uncode.dal.event;



/**
 * 
 * @author juny.ye

 */
public class EventObservable {

	private Lock lock = new ReentrantLock(true);

	private List<EventListener> listeners = new ArrayList<EventListener>();

	public void addListener(EventListener listener) {
		lock.lock();
		try {
			if (listener != null)
				listeners.add(listener);
		} finally {
			lock.unlock();
		}
	}

	public void deleteListener(EventListener listener) {
		lock.lock();
		try {
			if (listener != null)
				listeners.remove(listener);
		} finally {
			lock.unlock();
		}
	}

	public void notifyListenersBefore(Method method, Map<String, Object> content) {