- penyederhanaan dependency injection konfigurasi presensi dan service asinkronisasi

This commit is contained in:
salmanoe 2021-03-04 09:19:24 +07:00
parent 81d425bf57
commit 961696d55f
2 changed files with 20 additions and 11 deletions

View File

@ -4,6 +4,7 @@ import java.util.concurrent.Executor;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.AsyncConfigurer;
import org.springframework.scheduling.annotation.EnableAsync;
@ -11,23 +12,29 @@ import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
/**
*
* @author Syamsu
*/
*
* @author Syamsu
*/
@Configuration
@EnableAsync
@EnableScheduling
public class AsynchLogConfigure implements AsyncConfigurer {
@Value("${corePoolSizeAsyncConfigurer}")
Integer corePoolSizeAsyncConfigurer;
@Value("${maxPoolSizeAsyncConfigurer}")
Integer maxPoolSizeAsyncConfigurer;
@Override
public Executor getAsyncExecutor() {
ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
taskExecutor.setCorePoolSize(50);
taskExecutor.setMaxPoolSize(100);
taskExecutor.setThreadNamePrefix("jasmed-medifirst2000-executor-");
taskExecutor.initialize();
return taskExecutor;
taskExecutor.setCorePoolSize(corePoolSizeAsyncConfigurer);
taskExecutor.setMaxPoolSize(maxPoolSizeAsyncConfigurer);
taskExecutor.setThreadNamePrefix("jasmed-medifirst2000-executor-");
taskExecutor.initialize();
return taskExecutor;
}
@Override

View File

@ -17,6 +17,7 @@ import javax.imageio.ImageIO;
import javax.xml.bind.DatatypeConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.jasamedika.medifirst2000.constants.Master;
@ -42,6 +43,9 @@ import com.jasamedika.medifirst2000.vo.HabsenVO;
*/
@Service("absensiPegawaiService")
public class AbsensiPegawaiServiceImpl extends BaseVoServiceImpl implements AbsensiPegawaiService {
@Value("${presensiCapturePath}")
String presensiCapturePath;
@Autowired
private BaseConverterImpl<AbsensiPegawaiVO, AbsensiPegawai> absensiPegawaiConverter;
@ -152,9 +156,7 @@ public class AbsensiPegawaiServiceImpl extends BaseVoServiceImpl implements Abse
result = workingDir + "\\" + filename;
} else if (your_os.indexOf("nix") >= 0 || your_os.indexOf("nux") >= 0 || your_os.indexOf("mac") >= 0) {
// if_unix_or_mac
// result = workingDir + "//mnt//images//" + filename;
result = workingDir + "//tmp//" + filename;
// result = workingDir + "/" + filename;
result = workingDir + presensiCapturePath + filename;
} else {
// unknown_os?
result = workingDir + "/" + filename;