[Design of JBossCache] - Implicit marshalled values - a better way of handling region
by manik.surtani@jboss.com
We had this discussion in Neuchatel, I'm bringing it up again here to solidify an approach.
This pertains to JBCACHE-1231
Currently, we place direct object references in the cache. If the object in the cache is in a defined region with it's own class loader, we do the following when marshalling (and teh reverse for unmarshalling) the node (for replication, cache loading, etc etc).
1) serialize Fqn of the region
2) use the region's registered class loader to serialize cached objects
AFAIK - and please correct me if I am wrong - Brian, for HTTP sessions, your "cached objects" are MarshalledValue instances that only unmarshall when you do a MarshalledValue.get() as opposed to when the JBC marshaller unmarshalls.
I presume this means we have 2 levels of marshalling/unmarshalling, which could be wasteful.
How about we do this:
1. In JBC I have my own "MarshalledValue" equivalent, which stores a reference to the object, a byte array and a class loader (all of which can be built lazily).
2. When an object is put in cache (cache.put()) I create a MarshalledObject and store the object as well as the thread's class loader.
3. When the object is requested (cache.get()) I inspect the object and if it is a MarshalledValue, I return the object. If the object is not present, I deserialize the byte stream, first with the associated class loader, and if one is not present, the calling thread's class loader.
4. When replicating, the marshalled value serializes the object using the associated class loader. When receiving a replication event, the cache marshaller just creates a marshalled value with a null class loader and stores the byte array in the marshalled value, letting this unmarshall lazily when requested, as in 3. above.
The impact of this is:
* Gets rid of ugly Fqn hacks when marshalling streams
* No double marshalling for HTTP sessions
* Transparent classloader switching based on calling thread
* Lazy deserialization of replication (== faster sync replication)
The downsides:
* May mean changing client code if the client already deals with MarshalledValues (such as HTTP session clustering)
* Incompatible wire format with 2.0.0, but I am happy to break this as long as we provide an old, backward compatible marshaller.
Thoughts?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4114647#4114647
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4114647
16 years, 5 months
[Design of POJO Server] - Re: @ManagementRuntimeRef/@ManagementObjectRef/@ManagementOb
by alesj
"scott.stark(a)jboss.org" wrote :
| @ManagementRuntimeRef - annotation that can be used to identify which property defines the runtime component name. This annotation takes a transformer:
|
| | public interface RuntimeComponentNameTransformer
| | {
| | /**
| | * Transform the name from string.
| | *
| | * @param value current name value
| | * @return transformed name
| | */
| | Object transform(Object value);
| | }
| |
| this is used to identify what the name of the runtime kernel component is.
We are checking each object for this annotation - see AbstractManagedObjectFactory:
| ManagementRuntimeRef runtimeRef = (ManagementRuntimeRef) annotations.get(ManagementRuntimeRef.class.getName());
| if (runtimeRef != null)
| {
| componentName = icf.getComponentName(beanInfo, property, object, value);
| // let's try this as well
| if (componentName == null && icf != this)
| componentName = getComponentName(beanInfo, property, object, value);
| }
| }
| }
| if (componentName == null)
| componentName = icf.getComponentName(null, null, object, null);
|
We check each property, first with object's specific InstanceClassFactor, then with AMOF.
AMOF is transformer aware:
| public Object getComponentName(BeanInfo beanInfo, ManagedProperty property, Serializable object, MetaValue value)
| {
| if (beanInfo != null && property != null && value != null)
| {
| String name = getPropertyName(property);
| PropertyInfo propertyInfo = beanInfo.getProperty(name);
|
| ManagementRuntimeRef componentRef = propertyInfo.getUnderlyingAnnotation(ManagementRuntimeRef.class);
| if (componentRef != null)
| {
| Object original = metaValueFactory.unwrap(value, propertyInfo.getType());
| try
| {
| Class<? extends RuntimeComponentNameTransformer> tClass = componentRef.transformer();
| RuntimeComponentNameTransformer transformer;
| if (tClass != ManagementRuntimeRef.DEFAULT_NAME_TRANSFORMER.class)
| transformer = getComponentNameTransformer(configuration.getTypeInfo(tClass));
| else
| transformer = getComponentNameTransformer(propertyInfo.getType());
|
| return (transformer != null) ? transformer.transform(original) : original;
| }
| catch (Throwable t)
| {
| throw new UndeclaredThrowableException(t);
| }
| }
| }
| return null;
| }
|
The idea here is to provide KernelBus with the real runtime component name. e.g. in the case of MBeans, it's ObjectName.canonicalForm.
Currently we know how to get the runtime component name from BeanMetaData (getName) and ServiceMetaData (getCanonicalForm).
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4114600#4114600
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4114600
16 years, 5 months
[Design of JBoss Portal] - Automatically log someone in.
by badock
Hi, still on my SS0+Apache+Kerberos+JBossPortal problem.
I really feel like I am the only one writing on this forum :P
OK, so let's hear what's my new plan :
First of all, i have JBossPortal running behind an Apache.
That Apache authenticates users with Kerberos, and can store the login in the variable REMOTE_USER that is handed to JBoss.
Now, for identification, I use a LDAP and the jbossportal html form.
By modifying the login.jsp file, i can already fill the form with the login :
<input text="text" name="j_username" value="<% out.print(request.getAttribute("REMOTE_USER")); %>" />
And i also fill in the password with a value that is the same for every user in the LDAP (no need to have different passwords, the authentication has been done with Kerberos).
Now i'd like the form to Submit itself, so the user doesn't have to click nor can he get the oportunity to change the j_username variable.
Do you have any idea how can i do that ? For instance with a javascript maybe ?
Or can i use the response.sendRedirect(request.getContextxPath() + "/some/path/"); ?
Thanks in advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4114544#4114544
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4114544
16 years, 5 months
[Design of POJO Server] - Re: property values in ManagementViewImpl.applyTemplate
by alex.loubyansky@jboss.com
I had a problem with registering managed objects for MCF under their name (i.e.) jndi-name. The template info defines management interface, i.e. it creates managed objects and properties. Which are re-used to create different MCF's. The JNDI name is a value of a managed property. So, it can't be used in the template info as MO's name.
Currently, ManagedConnectionFactoryParserDeployer in build(...) method has the following hack
if(deployment.getDeployments() != null)
| {
| for(ManagedConnectionFactoryDeploymentMetaData mcf : deployment.getDeployments())
| {
| ManagedObject mo = moFactory.initManagedObject(mcf, null, null);
| if (mo != null)
| {
| // mcf.getClass().getName(), mo.getName() returns JndiName
| // which won't work in the DsDataSourceTemplateInfo
| managedObjects.put(mcf.getClass().getName(), mo);
| }
| }
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4114518#4114518
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4114518
16 years, 5 months