// Path: hazeltask-core/src/main/java/com/hazeltask/executor/ExecutorListener.java
// public interface ExecutorListener< G extends Serializable>{
//     public void beforeExecute(HazeltaskTask<G> runnable);
//     public void afterExecute(HazeltaskTask<G> runnable, Throwable exception);
// }
// 
// Path: hazeltask-core/src/main/java/com/hazeltask/executor/task/HazeltaskTask.java
// public class HazeltaskTask< G extends Serializable> 
//     implements Runnable, Task<G>, HazelcastInstanceAware, TrackCreated {
// 	private static final long serialVersionUID = 1L;
// 	
// 	private Runnable runTask;
// 	private Callable<?> callTask;
// 	
// 	private long createdAtMillis;
// 	private UUID id;
// 	private G group;
// 	private Serializable taskInfo;
// 	
// 	private int submissionCount;
// 	private transient HazelcastInstance hazelcastInstance;
// 	private transient Timer taskExecutedTimer;
// 	
// 	private volatile transient Object result;
//     private volatile transient Exception e;
// 	
//     //required for DataSerializable
//     protected HazeltaskTask(){}
//     
// 	public HazeltaskTask(UUID id, G group, Serializable taskInfo, Runnable task){
// 		this.runTask = task;
// 		this.id = id;
// 		this.group = group;
// 		createdAtMillis = System.currentTimeMillis();
// 		this.submissionCount = 1;
// 		this.taskInfo = taskInfo;
// 	}
// 	
// 	public HazeltaskTask(UUID id, G group, Serializable taskInfo, Callable<?> task){
//         this.callTask = task;
//         this.id = id;
//         this.group = group;
//         createdAtMillis = System.currentTimeMillis();
//         this.submissionCount = 1;
//         this.taskInfo = taskInfo;
//     }
// 	
// 	public void setSubmissionCount(int submissionCount){
// 	    this.submissionCount = submissionCount;
// 	}
// 	
// 	public int getSubmissionCount(){
// 	    return this.submissionCount;
// 	}
// 	
// 	public void updateCreatedTime(){
// 	    this.createdAtMillis = System.currentTimeMillis();
// 	}
// 
// 	public G getGroup() {
// 		return group;
// 	}
// 
// 	public Object getResult() {
//         return result;
//     }
// 
//     public Exception getException() {
//         return e;
//     }
// 	
// 	public long getTimeCreated(){
// 		return createdAtMillis;
// 	}
// 
//     public void run() {
//         Timer.Context ctx = null;
//         if(taskExecutedTimer != null)
//             ctx = taskExecutedTimer.time();
//         try {            
//             if(callTask != null) {
//     		    if(callTask instanceof HazelcastInstanceAware) {
//     		        ((HazelcastInstanceAware) callTask).setHazelcastInstance(hazelcastInstance);
//     		    }
//                 this.result = callTask.call();
//     		} else {
//     		    if(runTask instanceof HazelcastInstanceAware) {
//                     ((HazelcastInstanceAware) runTask).setHazelcastInstance(hazelcastInstance);
//                 }
//     		    runTask.run();
//     		}
//         } catch (Exception t) {
//             this.e = t;
//         } finally {
//             if(ctx != null)
//                 ctx.stop();
//         }
// 	}
//     
//     public Runnable getInnerRunnable() {
//         return this.runTask;
//     }
//     
//     public Callable<?> getInnerCallable() {
//         return this.callTask;
//     }
// 
//     @Override
//     public UUID getId() {
//         return id;
//     }
// 
//     @Override
//     public void setHazelcastInstance(HazelcastInstance hazelcastInstance) {
//         this.hazelcastInstance = hazelcastInstance;
//     }
//     
//     @Override
//     public void writeData(ObjectDataOutput out) throws IOException {
//         out.writeLong(id.getMostSignificantBits());
//         out.writeLong(id.getLeastSignificantBits());
//         
//         out.writeObject(group);
//         out.writeObject(runTask);
//         out.writeObject(callTask);
//         
//         out.writeLong(createdAtMillis);
//         out.writeInt(submissionCount);
//     }
// 
//     @SuppressWarnings("unchecked")
//     @Override
//     public void readData(ObjectDataInput in) throws IOException {
//         long m = in.readLong();
//         long l = in.readLong();
//         
//         id = new UUID(m, l);
//         group = (G) in.readObject();
//         runTask = (Runnable) in.readObject();
//         callTask = (Callable<?>) in.readObject();
//         
//         createdAtMillis = in.readLong();
//         submissionCount = in.readInt();
//     }
// 
//     public void setExecutionTimer(Timer taskExecutedTimer) {
//         this.taskExecutedTimer = taskExecutedTimer;
//     }
// 
//     public Serializable getTaskInfo() {
//         return taskInfo;
//     }
// 	
// }


import static org.mockito.Matchers.eq;
import static org.mockito.Matchers.isNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import java.util.UUID;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor.AbortPolicy;
import java.util.concurrent.TimeUnit;
import org.junit.Before;
import org.junit.Test;
import com.hazeltask.executor.ExecutorListener;
import com.hazeltask.executor.task.HazeltaskTask;
package com.hazeltask.executor.local;





public class HazeltaskThreadPoolExecutorTest {
    
    private HazeltaskThreadPoolExecutor listener;
// Path: hazeltask-core/src/main/java/com/hazeltask/executor/ExecutorListener.java
// public interface ExecutorListener< G extends Serializable>{
//     public void beforeExecute(HazeltaskTask<G> runnable);
//     public void afterExecute(HazeltaskTask<G> runnable, Throwable exception);
// }
// 
// Path: hazeltask-core/src/main/java/com/hazeltask/executor/task/HazeltaskTask.java
// public class HazeltaskTask< G extends Serializable> 
//     implements Runnable, Task<G>, HazelcastInstanceAware, TrackCreated {
// 	private static final long serialVersionUID = 1L;
// 	
// 	private Runnable runTask;
// 	private Callable<?> callTask;
// 	
// 	private long createdAtMillis;
// 	private UUID id;
// 	private G group;
// 	private Serializable taskInfo;
// 	
// 	private int submissionCount;
// 	private transient HazelcastInstance hazelcastInstance;
// 	private transient Timer taskExecutedTimer;
// 	
// 	private volatile transient Object result;
//     private volatile transient Exception e;
// 	
//     //required for DataSerializable
//     protected HazeltaskTask(){}
//     
// 	public HazeltaskTask(UUID id, G group, Serializable taskInfo, Runnable task){
// 		this.runTask = task;
// 		this.id = id;
// 		this.group = group;
// 		createdAtMillis = System.currentTimeMillis();
// 		this.submissionCount = 1;
// 		this.taskInfo = taskInfo;
// 	}
// 	
// 	public HazeltaskTask(UUID id, G group, Serializable taskInfo, Callable<?> task){
//         this.callTask = task;
//         this.id = id;
//         this.group = group;
//         createdAtMillis = System.currentTimeMillis();
//         this.submissionCount = 1;
//         this.taskInfo = taskInfo;
//     }
// 	
// 	public void setSubmissionCount(int submissionCount){
// 	    this.submissionCount = submissionCount;
// 	}
// 	
// 	public int getSubmissionCount(){
// 	    return this.submissionCount;
// 	}
// 	
// 	public void updateCreatedTime(){
// 	    this.createdAtMillis = System.currentTimeMillis();
// 	}
// 
// 	public G getGroup() {
// 		return group;
// 	}
// 
// 	public Object getResult() {
//         return result;
//     }
// 
//     public Exception getException() {
//         return e;
//     }
// 	
// 	public long getTimeCreated(){
// 		return createdAtMillis;
// 	}
// 
//     public void run() {
//         Timer.Context ctx = null;
//         if(taskExecutedTimer != null)
//             ctx = taskExecutedTimer.time();
//         try {            
//             if(callTask != null) {
//     		    if(callTask instanceof HazelcastInstanceAware) {
//     		        ((HazelcastInstanceAware) callTask).setHazelcastInstance(hazelcastInstance);
//     		    }
//                 this.result = callTask.call();
//     		} else {
//     		    if(runTask instanceof HazelcastInstanceAware) {
//                     ((HazelcastInstanceAware) runTask).setHazelcastInstance(hazelcastInstance);
//                 }
//     		    runTask.run();
//     		}
//         } catch (Exception t) {
//             this.e = t;
//         } finally {
//             if(ctx != null)
//                 ctx.stop();
//         }
// 	}
//     
//     public Runnable getInnerRunnable() {
//         return this.runTask;
//     }
//     
//     public Callable<?> getInnerCallable() {
//         return this.callTask;
//     }
// 
//     @Override
//     public UUID getId() {
//         return id;
//     }
// 
//     @Override
//     public void setHazelcastInstance(HazelcastInstance hazelcastInstance) {
//         this.hazelcastInstance = hazelcastInstance;
//     }
//     
//     @Override
//     public void writeData(ObjectDataOutput out) throws IOException {
//         out.writeLong(id.getMostSignificantBits());
//         out.writeLong(id.getLeastSignificantBits());
//         
//         out.writeObject(group);
//         out.writeObject(runTask);
//         out.writeObject(callTask);
//         
//         out.writeLong(createdAtMillis);
//         out.writeInt(submissionCount);
//     }
// 
//     @SuppressWarnings("unchecked")
//     @Override
//     public void readData(ObjectDataInput in) throws IOException {
//         long m = in.readLong();
//         long l = in.readLong();
//         
//         id = new UUID(m, l);
//         group = (G) in.readObject();
//         runTask = (Runnable) in.readObject();
//         callTask = (Callable<?>) in.readObject();
//         
//         createdAtMillis = in.readLong();
//         submissionCount = in.readInt();
//     }
// 
//     public void setExecutionTimer(Timer taskExecutedTimer) {
//         this.taskExecutedTimer = taskExecutedTimer;
//     }
// 
//     public Serializable getTaskInfo() {
//         return taskInfo;
//     }
// 	
// }


// Path: hazeltask-core/src/test/java/com/hazeltask/executor/local/HazeltaskThreadPoolExecutorTest.java
import static org.mockito.Matchers.eq;
import static org.mockito.Matchers.isNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import java.util.UUID;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor.AbortPolicy;
import java.util.concurrent.TimeUnit;
import org.junit.Before;
import org.junit.Test;
import com.hazeltask.executor.ExecutorListener;
import com.hazeltask.executor.task.HazeltaskTask;

package com.hazeltask.executor.local;





public class HazeltaskThreadPoolExecutorTest {
    
    private HazeltaskThreadPoolExecutor listener;
    private ExecutorListener listener1;