// Path: hazeltask-core/src/main/java/com/hazeltask/executor/IExecutorTopologyService.java
// public interface IExecutorTopologyService<GROUP extends Serializable> {
//     //public boolean isMemberReady(Member member);
//     
//     public void sendTask(HazeltaskTask<GROUP> task, Member member) throws TimeoutException;
//     
//     
//     /**
//      * 
//      * @param task
//      * @param replaceIfExists
//      * @return
//      */
//     public boolean addPendingTask(HazeltaskTask<GROUP> task, boolean replaceIfExists);
//     
//     /**
//      * Retrive the hazeltasks in the local pending task map with the predicate restriction
//      * @param predicate
//      * @return
//      */
//     public Collection<HazeltaskTask<GROUP>> getLocalPendingTasks(String predicate);
//     
//     /**
//      * Get the local queue sizes for each member
//      * 
//      * 
//      * @return
//      */
//     public Collection<MemberResponse<Long>> getMemberQueueSizes();
//     
//     /**
//      * Get the local queue sizes for each group on each member
//      * 
//      * 
//      * @return
//      */
//     public Collection<MemberResponse<Map<GROUP, Integer>>> getMemberGroupSizes();
//     
//     /**
//      * Get the local partition's size of the pending work map
//      * TODO: should this live in a different Service class?
//      * @return
//      */
//     public int getLocalPendingTaskMapSize();
//     
//     public Collection<MemberResponse<Long>> getOldestTaskTimestamps();
//     
//     /**
//      * 
//      * @param task
//      * @return true if removed, false it did not exist
//      */
//     public boolean removePendingTask(HazeltaskTask<GROUP> task);
//     public boolean removePendingTask(UUID taskId);
//     
//     public void broadcastTaskCompletion(UUID taskId, Serializable response, Serializable taskInfo);
//     public void broadcastTaskCancellation(UUID taskId, Serializable taskInfo);
//     public void broadcastTaskError(UUID taskId, Throwable exception, Serializable taskInfo);
//     public void addTaskResponseMessageHandler(MessageListener<TaskResponse<Serializable>> listener);
//     
//     public Lock getRebalanceTaskClusterLock();
//     
//     public Collection<HazeltaskTask<GROUP>> stealTasks(List<MemberValuePair<Long>> numToTake);
//     //public boolean addTaskToLocalQueue(HazelcastWork task);
//     
//     public Collection<MemberResponse<Integer>> getThreadPoolSizes();
//     public Collection<MemberResponse<Map<GROUP, Integer>>> getGroupSizes(Predicate<GROUP> predicate);
//     public void clearGroupQueue(GROUP group);
//     
//     public boolean cancelTask(GROUP group, UUID taskId);
// }
// 
// Path: hazeltask-core/src/main/java/com/hazeltask/hazelcast/MemberTasks.java
// public static class MemberResponse<T> implements Serializable {
//        private static final long serialVersionUID = 1L;
//         
//        private T value;
//        private Member member;
//        
//        public MemberResponse(){}
//         
//        public MemberResponse(Member member, T value) {
//            this.value = value;
//            this.member = member;
//        }
//        public T getValue() {
//            return value;
//        }
//        public Member getMember() {
//            return member;
//        }
//    }


import java.io.Serializable;
import java.util.Collection;
import java.util.Map;
import com.google.common.base.Predicate;
import com.hazeltask.executor.IExecutorTopologyService;
import com.hazeltask.hazelcast.MemberTasks.MemberResponse;
package com.hazeltask;



public class HazeltaskStatisticsService<GROUP extends Serializable> implements ClusterService<GROUP> {
    private final IExecutorTopologyService<GROUP> executorTopologyService;
    
// Path: hazeltask-core/src/main/java/com/hazeltask/executor/IExecutorTopologyService.java
// public interface IExecutorTopologyService<GROUP extends Serializable> {
//     //public boolean isMemberReady(Member member);
//     
//     public void sendTask(HazeltaskTask<GROUP> task, Member member) throws TimeoutException;
//     
//     
//     /**
//      * 
//      * @param task
//      * @param replaceIfExists
//      * @return
//      */
//     public boolean addPendingTask(HazeltaskTask<GROUP> task, boolean replaceIfExists);
//     
//     /**
//      * Retrive the hazeltasks in the local pending task map with the predicate restriction
//      * @param predicate
//      * @return
//      */
//     public Collection<HazeltaskTask<GROUP>> getLocalPendingTasks(String predicate);
//     
//     /**
//      * Get the local queue sizes for each member
//      * 
//      * 
//      * @return
//      */
//     public Collection<MemberResponse<Long>> getMemberQueueSizes();
//     
//     /**
//      * Get the local queue sizes for each group on each member
//      * 
//      * 
//      * @return
//      */
//     public Collection<MemberResponse<Map<GROUP, Integer>>> getMemberGroupSizes();
//     
//     /**
//      * Get the local partition's size of the pending work map
//      * TODO: should this live in a different Service class?
//      * @return
//      */
//     public int getLocalPendingTaskMapSize();
//     
//     public Collection<MemberResponse<Long>> getOldestTaskTimestamps();
//     
//     /**
//      * 
//      * @param task
//      * @return true if removed, false it did not exist
//      */
//     public boolean removePendingTask(HazeltaskTask<GROUP> task);
//     public boolean removePendingTask(UUID taskId);
//     
//     public void broadcastTaskCompletion(UUID taskId, Serializable response, Serializable taskInfo);
//     public void broadcastTaskCancellation(UUID taskId, Serializable taskInfo);
//     public void broadcastTaskError(UUID taskId, Throwable exception, Serializable taskInfo);
//     public void addTaskResponseMessageHandler(MessageListener<TaskResponse<Serializable>> listener);
//     
//     public Lock getRebalanceTaskClusterLock();
//     
//     public Collection<HazeltaskTask<GROUP>> stealTasks(List<MemberValuePair<Long>> numToTake);
//     //public boolean addTaskToLocalQueue(HazelcastWork task);
//     
//     public Collection<MemberResponse<Integer>> getThreadPoolSizes();
//     public Collection<MemberResponse<Map<GROUP, Integer>>> getGroupSizes(Predicate<GROUP> predicate);
//     public void clearGroupQueue(GROUP group);
//     
//     public boolean cancelTask(GROUP group, UUID taskId);
// }
// 
// Path: hazeltask-core/src/main/java/com/hazeltask/hazelcast/MemberTasks.java
// public static class MemberResponse<T> implements Serializable {
//        private static final long serialVersionUID = 1L;
//         
//        private T value;
//        private Member member;
//        
//        public MemberResponse(){}
//         
//        public MemberResponse(Member member, T value) {
//            this.value = value;
//            this.member = member;
//        }
//        public T getValue() {
//            return value;
//        }
//        public Member getMember() {
//            return member;
//        }
//    }


// Path: hazeltask-core/src/main/java/com/hazeltask/HazeltaskStatisticsService.java
import java.io.Serializable;
import java.util.Collection;
import java.util.Map;
import com.google.common.base.Predicate;
import com.hazeltask.executor.IExecutorTopologyService;
import com.hazeltask.hazelcast.MemberTasks.MemberResponse;

package com.hazeltask;



public class HazeltaskStatisticsService<GROUP extends Serializable> implements ClusterService<GROUP> {
    private final IExecutorTopologyService<GROUP> executorTopologyService;
    
    public HazeltaskStatisticsService(IExecutorTopologyService<GROUP> executorTopologyService) {