All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.kaka.notice.CommandPool Maven / Gradle / Ivy

The newest version!
package com.kaka.notice;

import com.kaka.util.ObjectPool;

import java.util.Objects;

/**
 * {@link Command}对象池
 * 
此类在类包外不可访问 * * @author zkpursuit */ class CommandPool extends ObjectPool { private final Facade context; final Class cls; final int priority; /** * 构造方法 * * @param context 事件调度中心 * @param maxSize 对象池大小,-1表示不进行池化 * @param cls 池化的类 * @param priority 执行优先级,数字小的先执行 */ CommandPool(Facade context, int maxSize, Class cls, int priority) { super(maxSize); this.context = context; this.cls = cls; this.priority = priority; } CommandPool(Class cls) { this(null, 0, cls, 0); } @Override protected Command newObject() { return (Command) this.context.createObject(cls); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; CommandPool that = (CommandPool) o; return cls.equals(that.cls); } @Override public int hashCode() { return Objects.hash(cls); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy