sharing global data between filters

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

sharing global data between filters

Radim Kolar
is there some inteligent way how to share some global data (dns cache
in my case) between Filters?

i mean avoiding to use static variables or subclassing Controller and adding
new field to it.

i am seeking for something per Controller like Context.setAttribute().

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: sharing global data between filters

Jeanfrancois Arcand-2

Salut,

Radim Kolar SF.NET wrote:
> is there some inteligent way how to share some global data (dns cache
> in my case) between Filters?
>
> i mean avoiding to use static variables or subclassing Controller and adding
> new field to it.
>
> i am seeking for something per Controller like Context.setAttribute().

Can you explain why Context.setAttribute will not works? I suspect you
want to add info once and keep it "forever"?

Thanks!

-- Jeanfrancois


>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: sharing global data between filters

Radim Kolar
> Can you explain why Context.setAttribute will not works? I suspect you want
> to add info once and keep it "forever"?

i think that every UDP packet gets its own Context object and attributes are
declared as private, not static, so data will not be shared between different
UDP packets.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: sharing global data between filters

Oleksiy Stashok
Hello,

this looks as good extension.
We can extends Context attribute functionality.
What about following:

context.setAttribute(LEVEL attrLevel, String attrName, Object attr);

Currently I can think about following levels: Application (static),
Controller, SelectorHandler, Request (default).

What do you think?
Think, it shouldn't be difficult to implement.

WBR,
Alexey.

Radim Kolar SF.NET wrote:

>> Can you explain why Context.setAttribute will not works? I suspect you want
>> to add info once and keep it "forever"?
>>    
>
> i think that every UDP packet gets its own Context object and attributes are
> declared as private, not static, so data will not be shared between different
> UDP packets.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>  

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: sharing global data between filters

Jeanfrancois Arcand-2
Salut,

Oleksiy Stashok wrote:
> Hello,
>
> this looks as good extension.
> We can extends Context attribute functionality.
> What about following:
>
> context.setAttribute(LEVEL attrLevel, String attrName, Object attr);

+1

>
> Currently I can think about following levels: Application (static),
> Controller, SelectorHandler, Request (default).
>
> What do you think?
> Think, it shouldn't be difficult to implement.

+1

Thanks!

-- Jeanfrancois

>
> WBR,
> Alexey.
>
> Radim Kolar SF.NET wrote:
>>> Can you explain why Context.setAttribute will not works? I suspect
>>> you want to add info once and keep it "forever"?
>>>    
>>
>> i think that every UDP packet gets its own Context object and
>> attributes are
>> declared as private, not static, so data will not be shared between
>> different
>> UDP packets.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>  
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: sharing global data between filters

Harsha Godugu
Nice idea (introducing Levels) Alexy.  +1 from myside too.

thanks..
Jeanfrancois Arcand wrote:

> Salut,
>
> Oleksiy Stashok wrote:
>> Hello,
>>
>> this looks as good extension.
>> We can extends Context attribute functionality.
>> What about following:
>>
>> context.setAttribute(LEVEL attrLevel, String attrName, Object attr);
>
> +1
>
>>
>> Currently I can think about following levels: Application (static),
>> Controller, SelectorHandler, Request (default).
>>
>> What do you think?
>> Think, it shouldn't be difficult to implement.
>
> +1
>
> Thanks!
>
> -- Jeanfrancois
>
>>
>> WBR,
>> Alexey.
>>
>> Radim Kolar SF.NET wrote:
>>>> Can you explain why Context.setAttribute will not works? I suspect
>>>> you want to add info once and keep it "forever"?
>>>>    
>>>
>>> i think that every UDP packet gets its own Context object and
>>> attributes are
>>> declared as private, not static, so data will not be shared between
>>> different
>>> UDP packets.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>>  
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: sharing global data between filters

Oleksiy Stashok
In reply to this post by Jeanfrancois Arcand-2
I've implemented this feature, but some different way.

Didn't want to create 3 separate methods for get/set/remove with Level
attribute in additional to ones already existed.
So added just 1 method:
public AttributeHolder getAttributeHolderByScope(AttributeScope scope);

which will return correspondent Attribute set.

Feedback is welcome.

Thanks.

WBR,
Alexey.

Jeanfrancois Arcand wrote:

> Salut,
>
> Oleksiy Stashok wrote:
>> Hello,
>>
>> this looks as good extension.
>> We can extends Context attribute functionality.
>> What about following:
>>
>> context.setAttribute(LEVEL attrLevel, String attrName, Object attr);
>
> +1
>
>>
>> Currently I can think about following levels: Application (static),
>> Controller, SelectorHandler, Request (default).
>>
>> What do you think?
>> Think, it shouldn't be difficult to implement.
>
> +1
>
> Thanks!
>
> -- Jeanfrancois
>
>>
>> WBR,
>> Alexey.
>>
>> Radim Kolar SF.NET wrote:
>>>> Can you explain why Context.setAttribute will not works? I suspect
>>>> you want to add info once and keep it "forever"?
>>>>    
>>>
>>> i think that every UDP packet gets its own Context object and
>>> attributes are
>>> declared as private, not static, so data will not be shared between
>>> different
>>> UDP packets.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>>  
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]