/* ================================================================== * Created [2009-4-27 下午11:32:55] by Jon.King * ================================================================== * TSS * ================================================================== * mailTo:jinpujun@hotmail.com * Copyright (c) Jon.King, 2009-2012 * ================================================================== */ package com.jinhe.tss.core.cachepool.extend.assignment; import com.jinhe.tss.core.cachepool.Cacheable; import com.jinhe.tss.core.cachepool.IArithmetic; import com.jinhe.tss.core.cachepool.TimeWrapper; /** * <p> * AssignmentPoolArithmetic.java * </p> * * 任务载体池算法器 * * @author Jon.King 2007-1-3 */ public abstract class AssignmentPoolArithmetic implements IArithmetic { public Cacheable create(Long cycleLife) { IAssignment assign = AssignmentFactory.getInstance().create(getAssignmentClass()); return new TimeWrapper(TimeWrapper.createRandomKey("Task"), assign, cycleLife); } public boolean isValid(Cacheable o) { return o != null && o.getValue() instanceof IAssignment; } public void destroy(Cacheable o) { o = null; } protected abstract String getAssignmentClass(); }