dev@grizzly.java.net

About setting attribute

From: Bongjae Chang <bongjae.chang_at_gmail.com>
Date: Tue, 17 Jan 2012 17:54:17 +0900

Hi,

When I set an attribute to NIOConnection, I had a problem.

Here is example.

When a connection established, I tried to attach an attribute to the
connection like this.
---
future = connectorHandler.connect(Š);
connection = future.get();
AttributeHolder attributeHolder = Connection.getAttributes();
attributeHolder.setAttribute("first", "sample1"); -----(1)
---
In my filter class, another attribute was defined like this.
---
private final Attribute anotherAttribute =
Grizzly.DEFAULT_ATTRIBUTE_BUILDER.createAttribute("another");
---
When I called the "anotherAttribute.get(connection)" first,  the first
attribute(1) returned.
When I reviewed sources about attributes, I found NIOConnection didn't have
Grizzly.DEFAULT_ATTRIBUTE_BUILDER  but
AttributeBuilder.DEFAULT_ATTRIBUTE_BUILDER.
So, attributes could get twisted in the same NIOConnection.
I would like to know if I used a wrong way for setting attribute associated
with connection.
Thanks.
Regards,
Bongjae Chang