public class ThreadTransCode implements Runnable{
@Override
public void run() {
System.out.println("转码开始..............");
}
}
class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
<property name="corePoolSize" value="3" />
<property name="keepAliveSeconds" value="200" />
<property name="maxPoolSize" value="5" />
<property name="queueCapacity" value="25" />
</bean>
class="com.enorth.lichen.action.video.SaveVideoAction"
scope="prototype">
<property name="videoService">
<ref bean="videoService" />
</property>
<property name="groupService">
<ref bean="groupService" />
</property>
<property name="taskExecutor">
<ref bean="taskExecutor" />
</property>
</bean>
public TaskExecutor getTaskExecutor() {
return taskExecutor;
}
public void setTaskExecutor(TaskExecutor taskExecutor) {
this.taskExecutor = taskExecutor;
}
public String execute() throws Exception {
for(int k = 0; k < 2; k++) {
taskExecutor.execute(new ThreadTransCode());
}
return SUCCESS;
}
public static synchronized void trans(String videoPath,String targetPath){
ThreadTransCode trans=new ThreadTransCode(videoPath,targetPath);
exec.execute(trans);
}