我的网络应用程序的某个地方有问题,但我找不到解决方案。我遇到了一个循环僵局,它们总是发生在 2 个豆子上。他们使用的资源虽然不在这两个 bean 之间共享。如果不是用 Weld 注入的一个 bean,我就找不到连接。
在堆栈跟踪中,我可以看到锁是由 Weld 处理的,但我不知道它试图(再次)锁定的锁定资源。
应用程序的主包是com.cmp.webapp。
com.cmp.webapp.PointOfSalesBean
,这是两个故障点之一,被注释掉了@javax.enterprise.context.ConversationBean
。
com.cmp.webapp.GeoManager
是@javax.enterprise.context.SessionScoped
。
com.cmp.webapp.service.KernelService
注入两个 bean 的范围也设置为 Session 。
锁定的线程之一报告了这一点:
http-thread-pool-8009(7) - threadId:2720 - state:WAITING
stackTrace:
java.lang.Thread.State: WAITING
at sun.misc.Unsafe.park(Native Method)
- waiting to lock <507d8fe7> (a java.util.concurrent.locks.ReentrantLock$NonfairSync) owned by "http-thread-pool-8009(2)" t@1375
at java.util.concurrent.locks.LockSupport.park(Unknown Source)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(Unknown Source)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(Unknown Source)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(Unknown Source)
at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(Unknown Source)
at java.util.concurrent.locks.ReentrantLock.lock(Unknown Source)
at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:101)
at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:90)
at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:79)
at com.cmp.webapp.service.GeoManager$Proxy$_$$_WeldClientProxy.getNationByCod(GeoManager$Proxy$_$$_WeldClientProxy.java)
at com.cmp.webapp.util.WSConverter.toAnag(WSConverter.java:208)
at com.cmp.webapp.service.KernelService.getAnagById(KernelService.java:515)
at com.cmp.webapp.service.KernelService$Proxy$_$$_WeldClientProxy.getAnagraphicDataById(KernelService$Proxy$_$$_WeldClientProxy.java)
at com.cmp.webapp.bean.kernel.RelationsBean.isCompany(RelationsBean.java:330)
at com.cmp.webapp.bean.kernel.RelationsBean.onChangeContractor(RelationsBean.java:131)
at com.cmp.webapp.bean.kernel.RelationsBean.create(RelationsBean.java:76)
at sun.reflect.GeneratedMethodAccessor9477.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:267)
at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)
at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:263)
at org.jboss.weld.introspector.jlr.WeldMethodImpl.invoke(WeldMethodImpl.java:174)
at org.jboss.weld.bean.AbstractClassBean.defaultPostConstruct(AbstractClassBean.java:398)
at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget.postConstruct(ManagedBean.java:174)
at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:294)
at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:107)
at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:90)
at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:79)
at com.cmp.webapp.bean.kernel.RelationsBean$Proxy$_$$_WeldClientProxy.beforeSavePolizza(RelationsBean$Proxy$_$$_WeldClientProxy.java)
at sun.reflect.GeneratedMethodAccessor9476.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:267)
at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)
at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:263)
at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:170)
at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:51)
at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:154)
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:245)
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:233)
at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:213)
at org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:590)
at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:585)
at org.jboss.weld.event.EventImpl.fire(EventImpl.java:69)
at com.cmp.webapp.service.KernelService.salvaPolizza(KernelService.java:1779)
at com.cmp.webapp.service.KernelService$Proxy$_$$_WeldClientProxy.salvaPolizza(KernelService$Proxy$_$$_WeldClientProxy.java)
at com.cmp.webapp.bean.UpgFacade.internalSave(UpgFacade.java:1037)
at com.cmp.webapp.bean.UpgFacade.internalSave(UpgFacade.java:1003)
at com.cmp.webapp.bean.UpgFacade.savePreventivo(UpgFacade.java:1103)
at com.cmp.webapp.bean.UpgFacade$Proxy$_$$_WeldClientProxy.savePreventivo(UpgFacade$Proxy$_$$_WeldClientProxy.java)
at com.cmp.webapp.bean.kernel.ProductionTypeBean.saveWithNoDocumentiIn(ProductionTypeBean.java:496)
at com.cmp.webapp.bean.kernel.ProductionTypeBean.save(ProductionTypeBean.java:472)
at com.cmp.webapp.bean.kernel.ProductionTypeBean$Proxy$_$$_WeldClientProxy.save(ProductionTypeBean$Proxy$_$$_WeldClientProxy.java)
at sun.reflect.GeneratedMethodAccessor9807.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.el.parser.AstValue.invoke(AstValue.java:254)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:302)
at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:39)
at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:101)
at org.primefaces.application.DialogActionListener.processAction(DialogActionListener.java:45)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:786)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1251)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:603)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:105)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:328)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
at com.sun.grizzly.http.ajp.AjpProcessorTask.invokeAdapter(AjpProcessorTask.java:135)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Unknown Source)
Locked ownable synchronizers:
- locked <520f51fb> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
另一个(Thread-2)如下:
http-thread-pool-8009(2) - threadId:1375 - state:WAITING
stackTrace:
java.lang.Thread.State: WAITING
at sun.misc.Unsafe.park(Native Method)
- waiting to lock <520f51fb> (a java.util.concurrent.locks.ReentrantLock$NonfairSync) owned by "http-thread-pool-8009(7)" t@2720
at java.util.concurrent.locks.LockSupport.park(Unknown Source)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(Unknown Source)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(Unknown Source)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(Unknown Source)
at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(Unknown Source)
at java.util.concurrent.locks.ReentrantLock.lock(Unknown Source)
at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:101)
at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:90)
at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:79)
at com.cmp.webapp.pos.PointOfSaleBean$Proxy$_$$_WeldClientProxy.isActive(PointOfSaleBean$Proxy$_$$_WeldClientProxy.java)
at com.cmp.webapp.wsproducer.SessionWebServiceFactory.prepareCredentials(SessionWebServiceFactory.java:148)
at com.cmp.webapp.wsproducer.SessionWebServiceFactory$1.invoke(SessionWebServiceFactory.java:200)
at com.sun.proxy.$Proxy707.getTable(Unknown Source)
at com.cmp.webapp.wsproducer.ServiceBase.getTable(BaseService.java:141)
at com.cmp.webapp.service.KernelService.getManagedAnagraphicTypes(ShellService.java:5496)
at com.cmp.webapp.service.KernelService$Proxy$_$$_WeldClientProxy.getManagedAnagraphicTypes(KernelService$Proxy$_$$_WeldClientProxy.java)
at com.cmp.webapp.bean.anag.SearchAnagBean.getManagedAnagraphicTypes(SearchAnagBean.java:1287)
at com.cmp.webapp.bean.anag.SearchAnagBean.initAnagraphicCategoriesByContext(SearchAnagBean.java:1248)
at com.cmp.webapp.bean.anag.SearchAnagBean.costruct(SearchAnagBean.java:274)
at sun.reflect.GeneratedMethodAccessor4976.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:267)
at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)
at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:263)
at org.jboss.weld.introspector.jlr.WeldMethodImpl.invoke(WeldMethodImpl.java:174)
at org.jboss.weld.bean.AbstractClassBean.defaultPostConstruct(AbstractClassBean.java:398)
at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget.postConstruct(ManagedBean.java:174)
at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:294)
at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:68)
at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:637)
at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:703)
at org.jboss.weld.injection.ParameterInjectionPoint.getValueToInject(ParameterInjectionPoint.java:120)
at org.jboss.weld.injection.MethodInjectionPoint.getParameterValues(MethodInjectionPoint.java:217)
at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstance(MethodInjectionPoint.java:137)
at org.jboss.weld.bean.ProducerMethod$ProducerMethodProducer.produce(ProducerMethod.java:136)
at org.jboss.weld.bean.AbstractProducerBean$AbstractProducer.produce(AbstractProducerBean.java:319)
at org.jboss.weld.bean.AbstractProducerBean.create(AbstractProducerBean.java:307)
at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:107)
at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:90)
at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:79)
at com.cmp.webapp.bean.anag.SearchAnagBean$Proxy$_$$_WeldClientProxy.init(SearchAnagBean$Proxy$_$$_WeldClientProxy.java)
at sun.reflect.GeneratedMethodAccessor10468.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.el.parser.AstValue.invoke(AstValue.java:254)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:302)
at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:39)
at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
at com.ocpsoft.pretty.faces.util.FacesElUtils.invokeMethod(FacesElUtils.java:70)
at com.ocpsoft.pretty.faces.util.FacesElUtils.invokeMethod(FacesElUtils.java:62)
at com.ocpsoft.pretty.faces.beans.ActionExecutor.executeActions(ActionExecutor.java:56)
at com.ocpsoft.pretty.faces.event.PrettyPhaseListener.processEvent(PrettyPhaseListener.java:131)
at com.ocpsoft.pretty.faces.event.PrettyPhaseListener.afterPhase(PrettyPhaseListener.java:117)
at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:189)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:107)
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:603)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:105)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:64)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:807)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:671)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:505)
at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:476)
at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:355)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:305)
at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:137)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:328)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
at com.sun.grizzly.http.ajp.AjpProcessorTask.invokeAdapter(AjpProcessorTask.java:135)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Unknown Source)
Locked ownable synchronizers:
- locked <507d8fe7> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
GeoManager.getNationByCod:
@javax.inject.Inject KernelService service;
@javax.annotation.PostConstruct
public void init() {
provinces = service.getProvinces();
}
public OptionLabel getNationByCod(String cod) {
if (cod== null)
return null;
List<OptionLabel> nations = service.getNationsList();
OptionLabel nation = null;
Iterator<OptionLabel> iter = nations.iterator();
while (iter.hasNext() && nation == null){
OptionLabel tmp = iter.next();
if (cod.equals(tmp.getCode())){
nation = tmp;
}
}
return nation;
}
PointOfSaleBean.isActive:
@javax.inject.Inject @com.cmp.webapp.annotations.HttpParam("posCmp") String cmpParameter;
@javax.inject.Inject @com.cmp.webapp.annotations.HttpParam("posAgent") String agentParameter;
@javax.inject.Inject @com.cmp.webapp.annotations.HttpParam("posSubAgent") String subAgentParameter;
@javax.inject.Inject @com.cmp.webapp.annotations.Logged User user;
@javax.inject.Inject KernelService service;
private Stack<PointOfSaleInfo> posStack = new Stack<PointOfSaleInfo>();
@javax.enterprise.inject.Produces @com.cmp.webapp.annotations.Current
public PointOfSaleInfo getPointOfSale() {
if (isEnabled() && !this.stackPointOfSale.isEmpty()) {
return this.stackPointOfSale.peek();
}
return null;
}
public boolean isActive() {
return companyExists() != null && agentExists() != null;
}
public String companyExists() {
return getPointOfSale() == null ? null : getPointOfSale().getComp();
}
public String agentExists()
return getPointOfSale() == null ? null : getPointOfSale().getAgent();
}
public boolean isEnabled() {
return enabled;
}
内核服务:
@javax.inject.Named("service")
@javax.enterprise.context.SessionScoped
public class KernelService extends ServiceBase implements WebServiceWrapper, Serializable {
@javax.annotation.PostConstruct
public void init() {
ServiceLoader<ServiceFactoryInterface> loader = ServiceLoader.load(ServiceFactoryInterface.class);
setFactory(loader.iterator().next());
getFactory().setFactory(PooledWebServiceFactory.istance());
}
@javax.inject.Inject @com.cmp.webapp.annotations.events.BeforeSaving Event<MsgSaveInType> beforeSaveEvent;
@javax.inject.Inject @com.cmp.webapp.annotations.Logged User user;
@javax.inject.Inject MemoBean memoBean;
@javax.inject.Inject PmlManagedBean pmlManagedBean;