
com.fimet.usecase.Session Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fimet-exe Show documentation
Show all versions of fimet-exe Show documentation
Execution implementarion of usecases and stress test for ISO8583
The newest version!
package com.fimet.usecase;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Delayed;
import java.util.concurrent.TimeUnit;
public class Session implements Delayed {
long timeout;
IUseCase useCase;
ISessionListener listener;
Map properties;
public Session(IUseCase useCase, ISessionListener listener, int timeout) {
this.listener = listener;
this.useCase = useCase;
this.timeout = System.currentTimeMillis() + timeout;
}
@Override
public int compareTo(Delayed o) {
long other = ((Session)o).timeout;
return timeout < other ? -1 : (timeout == other ? 0 : 1);
}
@Override
public long getDelay(TimeUnit unit) {
return unit.convert(timeout-System.currentTimeMillis(), TimeUnit.MILLISECONDS);
}
public void saveProperty(String key, String value) {
if (properties == null) {
properties = new HashMap();
}
properties.put(key, value);
}
public String getProperty(String key) {
if (properties != null) {
return properties.get(key);
}
return null;
}
public IUseCase getUseCase() {
return useCase;
}
public ISessionListener getListener() {
return listener;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy