提交 1081e864 编写于 作者: R Ray

clear debug

上级 96aad773
...@@ -29,10 +29,6 @@ import com.x.base.core.entity.annotation.CheckPersist; ...@@ -29,10 +29,6 @@ import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.CheckRemove; import com.x.base.core.entity.annotation.CheckRemove;
import com.x.base.core.entity.annotation.Flag; import com.x.base.core.entity.annotation.Flag;
import com.x.base.core.entity.annotation.RestrictFlag; import com.x.base.core.entity.annotation.RestrictFlag;
import com.x.base.core.entity.dynamic.DynamicBaseEntity;
import com.x.base.core.entity.dynamic.DynamicEntity;
import com.x.base.core.project.gson.XGsonBuilder;
import com.x.base.core.project.tools.ClassLoaderTools;
public abstract class SliceEntityManagerContainerFactory { public abstract class SliceEntityManagerContainerFactory {
...@@ -177,36 +173,4 @@ public abstract class SliceEntityManagerContainerFactory { ...@@ -177,36 +173,4 @@ public abstract class SliceEntityManagerContainerFactory {
} }
} }
// public void refreshDynamicEntity(String webApplicationDirectory, List<String> entities) throws Exception {
// File path = new File(webApplicationDirectory + "/WEB-INF/classes/" + PERSISTENCE_XML_PATH);
// List<String> classNames = PersistenceXmlHelper.write(path.getAbsolutePath(), entities, true);
// ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
// for (String className : classNames) {
// if (className.startsWith(DynamicEntity.CLASS_PACKAGE)
// || className.equals(DynamicBaseEntity.class.getName())) {
// @SuppressWarnings("unchecked")
// Class<? extends JpaObject> clz = (Class<? extends JpaObject>) classLoader.loadClass(className);
// checkPersistFieldMap.put(clz, this.loadCheckPersistField(clz));
// checkRemoveFieldMap.put(clz, this.loadCheckRemoveField(clz));
// Properties properties = PersistenceXmlHelper.properties(clz.getName(), false);
// entityManagerFactoryMap.put(clz,
// OpenJPAPersistence.createEntityManagerFactory(clz.getName(), PERSISTENCE_XML_PATH, properties));
// List<Field> flagFields = new ArrayList<>();
// List<Field> restrictFlagFields = new ArrayList<>();
// for (Field o : FieldUtils.getFieldsListWithAnnotation(clz, Id.class)) {
// flagFields.add(o);
// restrictFlagFields.add(o);
// }
// for (Field o : FieldUtils.getFieldsListWithAnnotation(clz, Flag.class)) {
// flagFields.add(o);
// restrictFlagFields.add(o);
// }
// for (Field o : FieldUtils.getFieldsListWithAnnotation(clz, RestrictFlag.class)) {
// restrictFlagFields.add(o);
// }
// flagMap.put(clz, Collections.unmodifiableList(flagFields));
// restrictFlagMap.put(clz, Collections.unmodifiableList(restrictFlagFields));
// }
// }
// }
} }
\ No newline at end of file
...@@ -34,7 +34,7 @@ import com.x.base.core.project.gson.XGsonBuilder; ...@@ -34,7 +34,7 @@ import com.x.base.core.project.gson.XGsonBuilder;
public class JsonPropertiesValueHandler extends AbstractValueHandler { public class JsonPropertiesValueHandler extends AbstractValueHandler {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final String PROXY_SUFFIX = "$proxy"; // private static final String PROXY_SUFFIX = "$proxy";
private Gson gson = XGsonBuilder.instance(); private Gson gson = XGsonBuilder.instance();
...@@ -72,10 +72,6 @@ public class JsonPropertiesValueHandler extends AbstractValueHandler { ...@@ -72,10 +72,6 @@ public class JsonPropertiesValueHandler extends AbstractValueHandler {
return null; return null;
try { try {
String className = vm.getDeclaredType().getName(); String className = vm.getDeclaredType().getName();
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
System.out.println(className + ":" + Thread.currentThread().getName() + ":"
+ Thread.currentThread().getContextClassLoader());
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
Class<?> cls = Thread.currentThread().getContextClassLoader().loadClass(className); Class<?> cls = Thread.currentThread().getContextClassLoader().loadClass(className);
return gson.fromJson(val.toString(), cls); return gson.fromJson(val.toString(), cls);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
......
...@@ -249,10 +249,6 @@ public class ApplicationServerTools extends JettySeverTools { ...@@ -249,10 +249,6 @@ public class ApplicationServerTools extends JettySeverTools {
List<ClassInfo> officialClassInfos) { List<ClassInfo> officialClassInfos) {
officialClassInfos.parallelStream().forEach(info -> { officialClassInfos.parallelStream().forEach(info -> {
try { try {
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!@@@@@@@@@");
System.out.println(Thread.currentThread().getContextClassLoader());
System.out.println(Thread.currentThread().getId());
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!@@@@@@@@@");
Class<?> clz = Thread.currentThread().getContextClassLoader().loadClass(info.getName()); Class<?> clz = Thread.currentThread().getContextClassLoader().loadClass(info.getName());
Path war = Paths.get(Config.dir_store().toString(), info.getSimpleName() + PathTools.DOT_WAR); Path war = Paths.get(Config.dir_store().toString(), info.getSimpleName() + PathTools.DOT_WAR);
Path dir = Paths.get(Config.dir_servers_applicationServer_work().toString(), info.getSimpleName()); Path dir = Paths.get(Config.dir_servers_applicationServer_work().toString(), info.getSimpleName());
......
package com.x.processplatform.assemble.surface; package com.x.processplatform.assemble.surface;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.x.base.core.project.Context; import com.x.base.core.project.Context;
import com.x.base.core.project.cache.CacheManager; import com.x.base.core.project.cache.CacheManager;
import com.x.base.core.project.message.MessageConnector; import com.x.base.core.project.message.MessageConnector;
...@@ -13,6 +20,20 @@ public class ThisApplication { ...@@ -13,6 +20,20 @@ public class ThisApplication {
protected static Context context; protected static Context context;
private static ExecutorService threadPool;
public static ExecutorService threadPool() {
return threadPool;
}
private static void initThreadPool() {
int maximumPoolSize = Runtime.getRuntime().availableProcessors() + 1;
ThreadFactory threadFactory = new ThreadFactoryBuilder()
.setNameFormat(ThisApplication.class.getPackageName() + "-threadpool-%d").build();
threadPool = new ThreadPoolExecutor(0, maximumPoolSize, 120, TimeUnit.SECONDS, new SynchronousQueue<>(),
threadFactory);
}
public static Context context() { public static Context context() {
return context; return context;
} }
...@@ -21,6 +42,7 @@ public class ThisApplication { ...@@ -21,6 +42,7 @@ public class ThisApplication {
try { try {
CacheManager.init(context.clazz().getSimpleName()); CacheManager.init(context.clazz().getSimpleName());
context.schedule(CleanKeyLock.class, "2 0/2 * * * ?"); context.schedule(CleanKeyLock.class, "2 0/2 * * * ?");
initThreadPool();
MessageConnector.start(context()); MessageConnector.start(context());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -3,9 +3,7 @@ package com.x.processplatform.assemble.surface.jaxrs.control; ...@@ -3,9 +3,7 @@ package com.x.processplatform.assemble.surface.jaxrs.control;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.BooleanUtils;
...@@ -19,6 +17,7 @@ import com.x.base.core.project.logger.Logger; ...@@ -19,6 +17,7 @@ import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory; import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.tools.PropertyTools; import com.x.base.core.project.tools.PropertyTools;
import com.x.processplatform.assemble.surface.Business; import com.x.processplatform.assemble.surface.Business;
import com.x.processplatform.assemble.surface.ThisApplication;
import com.x.processplatform.core.entity.content.Read; import com.x.processplatform.core.entity.content.Read;
import com.x.processplatform.core.entity.content.Task; import com.x.processplatform.core.entity.content.Task;
import com.x.processplatform.core.entity.content.TaskCompleted; import com.x.processplatform.core.entity.content.TaskCompleted;
...@@ -80,7 +79,7 @@ class ActionGetWorkOrWorkCompleted extends BaseAction { ...@@ -80,7 +79,7 @@ class ActionGetWorkOrWorkCompleted extends BaseAction {
logger.error(e); logger.error(e);
} }
return wo; return wo;
}); }, ThisApplication.threadPool());
} }
private Wo workCompleted(Business business, EffectivePerson effectivePerson, WorkCompleted workCompleted) private Wo workCompleted(Business business, EffectivePerson effectivePerson, WorkCompleted workCompleted)
......
...@@ -11,6 +11,7 @@ import com.x.base.core.project.jaxrs.StandardJaxrsAction; ...@@ -11,6 +11,7 @@ import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.base.core.project.logger.Logger; import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory; import com.x.base.core.project.logger.LoggerFactory;
import com.x.processplatform.assemble.surface.Business; import com.x.processplatform.assemble.surface.Business;
import com.x.processplatform.assemble.surface.ThisApplication;
abstract class BaseAction extends StandardJaxrsAction { abstract class BaseAction extends StandardJaxrsAction {
...@@ -153,10 +154,8 @@ abstract class BaseAction extends StandardJaxrsAction { ...@@ -153,10 +154,8 @@ abstract class BaseAction extends StandardJaxrsAction {
} }
protected CompletableFuture<Boolean> checkControlFuture(EffectivePerson effectivePerson, String flag, protected CompletableFuture<Boolean> checkControlFuture(EffectivePerson effectivePerson, String flag) {
ClassLoader classLoader) {
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
Thread.currentThread().setContextClassLoader(classLoader);
Boolean value = false; Boolean value = false;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc); Business business = new Business(emc);
...@@ -166,7 +165,7 @@ abstract class BaseAction extends StandardJaxrsAction { ...@@ -166,7 +165,7 @@ abstract class BaseAction extends StandardJaxrsAction {
logger.error(e); logger.error(e);
} }
return value; return value;
}); }, ThisApplication.threadPool());
} }
} }
...@@ -113,10 +113,8 @@ abstract class BaseAction extends StandardJaxrsAction { ...@@ -113,10 +113,8 @@ abstract class BaseAction extends StandardJaxrsAction {
} }
} }
protected CompletableFuture<Boolean> checkControlFuture(EffectivePerson effectivePerson, String flag, protected CompletableFuture<Boolean> checkControlFuture(EffectivePerson effectivePerson, String flag) {
ClassLoader classLoader) {
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
Thread.currentThread().setContextClassLoader(classLoader);
Boolean value = false; Boolean value = false;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc); Business business = new Business(emc);
......
...@@ -33,6 +33,7 @@ import com.x.base.core.project.organization.Person; ...@@ -33,6 +33,7 @@ import com.x.base.core.project.organization.Person;
import com.x.base.core.project.organization.Unit; import com.x.base.core.project.organization.Unit;
import com.x.base.core.project.tools.ListTools; import com.x.base.core.project.tools.ListTools;
import com.x.processplatform.assemble.surface.Business; import com.x.processplatform.assemble.surface.Business;
import com.x.processplatform.assemble.surface.ThisApplication;
import com.x.processplatform.core.entity.content.Attachment; import com.x.processplatform.core.entity.content.Attachment;
import com.x.processplatform.core.entity.content.Data; import com.x.processplatform.core.entity.content.Data;
import com.x.processplatform.core.entity.content.Read; import com.x.processplatform.core.entity.content.Read;
...@@ -157,7 +158,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction { ...@@ -157,7 +158,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction {
} catch (Exception e) { } catch (Exception e) {
logger.error(e); logger.error(e);
} }
}); }, ThisApplication.threadPool());
} }
private CompletableFuture<Void> taskFuture(EffectivePerson effectivePerson, String job, String workId, Wo wo) { private CompletableFuture<Void> taskFuture(EffectivePerson effectivePerson, String job, String workId, Wo wo) {
...@@ -169,7 +170,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction { ...@@ -169,7 +170,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction {
} catch (Exception e) { } catch (Exception e) {
logger.error(e); logger.error(e);
} }
}); }, ThisApplication.threadPool());
} }
private CompletableFuture<Void> attachmentFuture(EffectivePerson effectivePerson, String job, Wo wo) { private CompletableFuture<Void> attachmentFuture(EffectivePerson effectivePerson, String job, Wo wo) {
...@@ -202,7 +203,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction { ...@@ -202,7 +203,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction {
} catch (Exception e) { } catch (Exception e) {
logger.error(e); logger.error(e);
} }
}); }, ThisApplication.threadPool());
} }
private CompletableFuture<Void> readFuture(EffectivePerson effectivePerson, String job, Wo wo) { private CompletableFuture<Void> readFuture(EffectivePerson effectivePerson, String job, Wo wo) {
...@@ -214,7 +215,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction { ...@@ -214,7 +215,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction {
} catch (Exception e) { } catch (Exception e) {
logger.error(e); logger.error(e);
} }
}); }, ThisApplication.threadPool());
} }
private CompletableFuture<Void> workJsonFuture(Work work, Wo wo) { private CompletableFuture<Void> workJsonFuture(Work work, Wo wo) {
...@@ -224,7 +225,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction { ...@@ -224,7 +225,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction {
} catch (Exception e) { } catch (Exception e) {
logger.error(e); logger.error(e);
} }
}); }, ThisApplication.threadPool());
} }
private CompletableFuture<Void> activityRouteFuture(Work work, Wo wo) { private CompletableFuture<Void> activityRouteFuture(Work work, Wo wo) {
...@@ -243,7 +244,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction { ...@@ -243,7 +244,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction {
} catch (Exception e) { } catch (Exception e) {
logger.error(e); logger.error(e);
} }
}); }, ThisApplication.threadPool());
} }
private CompletableFuture<Void> creatorIdentityFuture(String creatorIdentity, Wo wo) { private CompletableFuture<Void> creatorIdentityFuture(String creatorIdentity, Wo wo) {
...@@ -254,7 +255,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction { ...@@ -254,7 +255,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction {
} catch (Exception e) { } catch (Exception e) {
logger.error(e); logger.error(e);
} }
}); }, ThisApplication.threadPool());
} }
private CompletableFuture<Void> creatorPersonFuture(String creatorPerson, Wo wo) { private CompletableFuture<Void> creatorPersonFuture(String creatorPerson, Wo wo) {
...@@ -265,7 +266,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction { ...@@ -265,7 +266,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction {
} catch (Exception e) { } catch (Exception e) {
logger.error(e); logger.error(e);
} }
}); }, ThisApplication.threadPool());
} }
private CompletableFuture<Void> creatorUnitFuture(String creatorUnit, Wo wo) { private CompletableFuture<Void> creatorUnitFuture(String creatorUnit, Wo wo) {
...@@ -276,7 +277,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction { ...@@ -276,7 +277,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction {
} catch (Exception e) { } catch (Exception e) {
logger.error(e); logger.error(e);
} }
}); }, ThisApplication.threadPool());
} }
private CompletableFuture<Void> workCompletedJsonFuture(WorkCompleted workCompleted, Wo wo) { private CompletableFuture<Void> workCompletedJsonFuture(WorkCompleted workCompleted, Wo wo) {
...@@ -286,7 +287,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction { ...@@ -286,7 +287,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction {
} catch (Exception e) { } catch (Exception e) {
logger.error(e); logger.error(e);
} }
}); }, ThisApplication.threadPool());
} }
private CompletableFuture<Void> recordFuture(EffectivePerson effectivePerson, String job, Wo wo) { private CompletableFuture<Void> recordFuture(EffectivePerson effectivePerson, String job, Wo wo) {
...@@ -297,7 +298,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction { ...@@ -297,7 +298,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction {
} catch (Exception e) { } catch (Exception e) {
logger.error(e); logger.error(e);
} }
}); }, ThisApplication.threadPool());
} }
private CompletableFuture<Void> workCompletedRecordFuture(EffectivePerson effectivePerson, private CompletableFuture<Void> workCompletedRecordFuture(EffectivePerson effectivePerson,
...@@ -315,7 +316,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction { ...@@ -315,7 +316,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction {
} catch (Exception e) { } catch (Exception e) {
logger.error(e); logger.error(e);
} }
}); }, ThisApplication.threadPool());
} }
private CompletableFuture<Void> workCompletedDataFuture(WorkCompleted workCompleted, Wo wo) { private CompletableFuture<Void> workCompletedDataFuture(WorkCompleted workCompleted, Wo wo) {
...@@ -337,7 +338,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction { ...@@ -337,7 +338,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction {
logger.error(e); logger.error(e);
} }
} }
}); }, ThisApplication.threadPool());
} }
private boolean attachmentRead(Attachment attachment, EffectivePerson effectivePerson, List<String> identities, private boolean attachmentRead(Attachment attachment, EffectivePerson effectivePerson, List<String> identities,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册