|
|
@ -18,20 +18,18 @@ public class LogisticsRuntimeService { |
|
|
*/ |
|
|
*/ |
|
|
public LogisticsRuntime findByEnvCode(long envId) { |
|
|
public LogisticsRuntime findByEnvCode(long envId) { |
|
|
synchronized (LOCK) { |
|
|
synchronized (LOCK) { |
|
|
LogisticsRuntime runtime = runtimeMap.get(envId); |
|
|
return runtimeMap.get(envId); |
|
|
if (runtime != null) { |
|
|
|
|
|
return runtime; |
|
|
|
|
|
} |
|
|
|
|
|
return null; |
|
|
|
|
|
// throw new RuntimeException("LogisticsRuntime not found for envCode: " + envId);
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void createEnv(int envId) { |
|
|
public void createEnv(long envId) { |
|
|
synchronized (LOCK) { |
|
|
synchronized (LOCK) { |
|
|
|
|
|
if (runtimeMap.containsKey(envId)) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
LogisticsEnv env = new LogisticsEnv(); |
|
|
LogisticsEnv env = new LogisticsEnv(); |
|
|
env.setEnvId(envId); |
|
|
env.setEnvId(envId); |
|
|
env.setVirtual(envId != 1); |
|
|
env.setVirtual(envId != 1L); |
|
|
|
|
|
|
|
|
LogisticsRuntime runtime = new LogisticsRuntime(env); |
|
|
LogisticsRuntime runtime = new LogisticsRuntime(env); |
|
|
runtimeMap.put(env.getEnvId(), runtime); |
|
|
runtimeMap.put(env.getEnvId(), runtime); |
|
|
|