You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**GWT version: 2.8.2
**Browser (with version): All
**Operating System: All
Hi.
I am working in a integration GWT2.8.2 an Weld 2.4.6.Final to inject Locator class in process context.
For doing this job i created a ServiceLocator instance that return a injected Locator, simple like this:
@OverRide
public Object getInstance(Class<?> clazz) {
return WeldUtility.getBean(clazz);
}
But...
Some times the class LocatorServiceLayer use the function newInstance to create new Locator's instance.
For me the correct way to work is the LocatorServiceLayer class create only an instance of ServiceLocator and than use getInstance to get a Locator. But sometimes it use the ServiceLocator others it use newInstance to get Locator.
Steps to reproduce
Put a break point in newInstance a LocatorServiceLayer's method and verifies that a Locator class is one parameters
Known workarounds
@OverRide
public <T extends Locator> T createLocator(Class clazz) {
//return newInstance(clazz, Locator.class);
ServiceLocator serviceLocatorClazz = resolveServiceLocator(requestContext);
if (clazz != null)
return newInstance(serviceLocatorClazz, ServiceLocator.class ).getInstance(clazz);
else
return newInstance(clazz, Locator.class);
}
Links to further discussions
The text was updated successfully, but these errors were encountered:
If this is specific to weld and the rest of your environment, we may need a more comprehensive example.
That said, a ServiceLayerDecorator is almost certainly needed to customize creation of your Locators and ServiceLocators, especially if you have a custom way to get a Locator based on the ServiceLocator (as the ServiceLocator is written to locate Services, and not entity locators). If that is your criticism, then as I understand it this is by design.
Your note "some times" does confuse me though, without overriding this, Locators should always be created via LocatorServiceLayer.createLocator. My best guess is that you are encountering the caching mechanism described in ServiceLayer.ENABLE_CACHE.
Hi niloc132 first, thanks a lot.
Is better i explain why i am doing this integration. My critic of GWT's architecture is two:
There are to much new objects bean creating all time.
There are no "save state" objects between requests.
To resolve problems i proposed a integration with Weld.
After some debug i discovered that the problem is in createReturnOperations of SimpleRequestProcessor class.
In processInvocationMessages there is a if that verify if the service requires a service locator at line 457. So during the process of processInvocationMessages method from SimpleRequestProcessor class, it uses Locators from ServiceLocator by passing it in args, but during the process of createReturnOperations and others operation it does not verify the need of ServiceLocator. It delegate the locator to LocatorServiceLayer that create a new instance calling newInstance.
I disable cache by setting gwt.rf.ServiceLayerCache=false.
**GWT version: 2.8.2
**Browser (with version): All
**Operating System: All
Hi.
I am working in a integration GWT2.8.2 an Weld 2.4.6.Final to inject Locator class in process context.
For doing this job i created a ServiceLocator instance that return a injected Locator, simple like this:
@OverRide
public Object getInstance(Class<?> clazz) {
return WeldUtility.getBean(clazz);
}
But...
Some times the class LocatorServiceLayer use the function newInstance to create new Locator's instance.
For me the correct way to work is the LocatorServiceLayer class create only an instance of ServiceLocator and than use getInstance to get a Locator. But sometimes it use the ServiceLocator others it use newInstance to get Locator.
Steps to reproduce
Put a break point in newInstance a LocatorServiceLayer's method and verifies that a Locator class is one parameters
Known workarounds
@OverRide
public <T extends Locator> T createLocator(Class clazz) {
//return newInstance(clazz, Locator.class);
ServiceLocator serviceLocatorClazz = resolveServiceLocator(requestContext);
if (clazz != null)
return newInstance(serviceLocatorClazz, ServiceLocator.class ).getInstance(clazz);
else
return newInstance(clazz, Locator.class);
}
Links to further discussions
The text was updated successfully, but these errors were encountered: