Interesting behavior of struts 2.1

2010-03-24 Thread Eduard Neuwirt

Hello all,

I am facing a strange problem. If I redefine in web.xml the 
struts-filters (see following xml-snip), the struts works fine, but I 
loose my location settings after FORWARDING.


Any idea ? Please advice.

Regards
Eduard
P.S.: I haven't debugged  the struts code.


   openSessionInViewFilter
   /*
   REQUEST
   FORWARD
   
   
   struts-cleanup
   /*
   REQUEST
   FORWARD
   
   
   sitemesh
   /*
   REQUEST
   FORWARD
   
   
   struts
   /*
   REQUEST
   FORWARD
   


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



interesting...

2009-08-28 Thread Tommy Pham
On the home site of struts.apache.org as of 2009.08.28.03.24 PDT:

The Infrastructure Team of The Apache Software Foundation is currently 
investigating a 
potential compromise of one of our servers. For security reasons most 
apache.org 
services are therefore offline, but will be restored shortly. We apologies for 
any 
inconvenience this may cause.

:(


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: interesting proxy + action chain issue

2008-04-11 Thread Brad A Cupit
oh yes, yes, it would include those parameters in the request, but I'd
have to figure out some OGNL that would add actionErrors and fieldErrors
as parameters for the redirect, then if my Action-being-redirected-to
extends ActionSupport the setters should automatically be called.

I think this would be done often enough that it could be built into the
Result.

At this point, however, the default behavior of not doing
POST-redirect-GET for validation errors seems to work just fine for me.
So I think I'll only do POST-redirect-GET on successful POSTs which pass
validation.

Brad Cupit
Louisiana State University - UIS

-Original Message-
From: Guillaume Bilodeau [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 10, 2008 8:06 PM
To: user@struts.apache.org
Subject: RE: interesting proxy + action chain issue


I'm not sure if I'm missing something here, but using the
ServletActionRedirectResult with parse=true and extra parameters does
include these parameters in the redirect URL.

The problem is that this mechanism is limited to string-based (or
string-parseable) parameters, so you're ruling out objects like an
ArrayList
that would contain error messages.  That's where something like flash
scope
would be useful and is unfortunately lacking in 2.0.

Cheers,
GB


Brad A Cupit wrote:
> 
> Hi Guillaume,
> yep, I'm familiar with the ServletActionRedirectResult, and I'm
> especially familiar with bug you mentioned (you and I both commented
on
> it, asking for a backport to 2.0.x...on that note, anyone with commit
> access want to backport
https://issues.apache.org/struts/browse/WW-2170
> and release 2.0.12? The patch is there and ready to go)  :-)
> 
> What I'm not sure how to do is to get the error messages into the
> redirect url, and it seems like something you'd want often enough for
it
> to be built-in to ServletActionRedirectResult (or a class which
extends
> it).
> 
> Brad Cupit
> Louisiana State University - UIS
> 
> 
> -Original Message-
> From: Guillaume Bilodeau [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, April 10, 2008 1:24 PM
> To: user@struts.apache.org
> Subject: RE: interesting proxy + action chain issue
> 
> 
> Hi Brad,
> 
> Have you tried this:
> http://www.vitarara.org/cms/struts_2_cookbook/post_and_redirect
> 
> I've used this for a while with good results, although recently I've
> stumbled on WW-2170 ( https://issues.apache.org/struts/browse/WW-2170
).
> It
> seems to occur only when using annotations though.
> 
> Cheers,
> GB
> 
> 
> Brad A Cupit wrote:
>> 
>> The only problem with the scope plugin is that it will use the
> session,
>> which may break the whole notion of POST-redirect-GET: if the data in
>> the session is removed or replaced by later requests, then pressing
> the
>> back or refresh buttons on the initial page with errors will not
yield
>> the same response.
>> 
>> I think it would be cool if the errors were url parameters as part of
>> the redirect, but there's currently no easy way to do this. Could a
>> custom interceptor realize that the result is a redirect and turn the
>> validation errors into url parameters? Or would this need to be a
> custom
>> result class (perhaps extending ServletRedirectResult or
>> ServletActionRedirectResult)?
>> 
>> Brad Cupit
>> Louisiana State University - UIS
>> 
>> -Original Message-
>> From: Jeromy Evans [mailto:[EMAIL PROTECTED] 
>> Sent: Tuesday, April 08, 2008 6:24 PM
>> To: Struts Users Mailing List
>> Subject: Re: interesting proxy + action chain issue
>> 
>> Ian Meikle wrote:
>>> HI,
>>>
>>> I have been following this post with interest since I used the PRG
>> pattern 
>>> in previous projects.
>>> We are using struts 2 in are current project and I like the
>> errorMessages 
>>> behaviour that is part of the Action.
>>>
>>> Is it possible to persist these over the PRG cycle ?
>>> By default I assume they would be lost when we get to the GET stage
>> since 
>>> they are request scope and the GET is a seperate request than the
> POST
>> 
>>> that caused  the error.
>>>
>>>   
>> 
>> Hi Ian,
>> This is an issue that Struts2 needs to handle better.  It can be done

>> but its not as straight-forward as it could be.
>> 
>> The scope interceptor [1] provides this feature. It allows you to 
>> specify which properties should be bound to session or application
> scope
>> 
>> and injected into the action.
>> The scoped m

Re: interesting proxy + action chain issue

2008-04-11 Thread Jeromy Evans

Ian Meikle wrote:

Hi Jeromy,

Thanks for the info. 
Several of the interceptors require configuring, for example the Scope 
interceptor.
The example provides some examples of this. However it seems that the only 
way to configure a interceptor is to redefine an interceptor stack.

Is this correct ?
Can I not just use the default stack, and configure the specific 
interceptor for a specific actions use ?


Regards
Ian

  


Hi Ian,

If you define your actions in Struts.xml you can include an 
 tag that references an interceptor to use and/or 
interceptor stack to use.
Order is important; you can insert an interceptor before or after the 
stack.  You can only insert interceptors into a stack by splitting the 
stack definition.


Here's an example I frequently use to get achieve params-prepare-params 
pattern.  Params:

 
   

   
  

If you're using annotations, as far as I know you need to setup a 
package with an appropriate stack and reference the package.
The scope plugin allows you to use annotations to configure the scope 
rather than the xml/package.


Does that help?

regards,
Jeromy Evans



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: interesting proxy + action chain issue

2008-04-11 Thread Ian Meikle
Hi Jeromy,

Thanks for the info. 
Several of the interceptors require configuring, for example the Scope 
interceptor.
The example provides some examples of this. However it seems that the only 
way to configure a interceptor is to redefine an interceptor stack.
Is this correct ?
Can I not just use the default stack, and configure the specific 
interceptor for a specific actions use ?

Regards
Ian


CSC Solutions Norge AS
Registered Office: SandsliƄsen 57, 5254 Sandsli, Norway 
Registered in Norway No: 958 958 455

-
This is a PRIVATE message. If you are not the intended recipient, please 
delete without copying and kindly advise us by e-mail of the mistake in 
delivery. 
NOTE: Regardless of content, this e-mail shall not operate to bind CSC to 
any order or other contract unless pursuant to explicit written agreement 
or government initiative expressly permitting the use of e-mail for such 
purpose.
-




Jeromy Evans <[EMAIL PROTECTED]> 
09.04.2008 01:23
Please respond to
"Struts Users Mailing List" 


To
Struts Users Mailing List 
cc

Subject
Re: interesting proxy + action chain issue






Ian Meikle wrote:
> HI,
>
> I have been following this post with interest since I used the PRG 
pattern 
> in previous projects.
> We are using struts 2 in are current project and I like the 
errorMessages 
> behaviour that is part of the Action.
>
> Is it possible to persist these over the PRG cycle ?
> By default I assume they would be lost when we get to the GET stage 
since 
> they are request scope and the GET is a seperate request than the POST 
> that caused  the error.
>
> 

Hi Ian,
This is an issue that Struts2 needs to handle better.  It can be done 
but its not as straight-forward as it could be.

The scope interceptor [1] provides this feature. It allows you to 
specify which properties should be bound to session or application scope 
and injected into the action.
The scoped modeldriven interceptor is for modeldriven actions [2].  Both 
are included in the default stack.

The scope plugin allows annotations to specify which properties persist 
over a cycle.  It's not bundled with struts but I have heard good 
comments about it [4].

[1] http://cwiki.apache.org/WW/scope-interceptor.html
[2] http://cwiki.apache.org/WW/scoped-model-driven-interceptor.html
[3] http://cwiki.apache.org/S2PLUGINS/scope-plugin.html
[4] http://article.gmane.org/gmane.comp.jakarta.struts.devel/65052

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: interesting proxy + action chain issue

2008-04-10 Thread Guillaume Bilodeau

I'm not sure if I'm missing something here, but using the
ServletActionRedirectResult with parse=true and extra parameters does
include these parameters in the redirect URL.

The problem is that this mechanism is limited to string-based (or
string-parseable) parameters, so you're ruling out objects like an ArrayList
that would contain error messages.  That's where something like flash scope
would be useful and is unfortunately lacking in 2.0.

Cheers,
GB


Brad A Cupit wrote:
> 
> Hi Guillaume,
> yep, I'm familiar with the ServletActionRedirectResult, and I'm
> especially familiar with bug you mentioned (you and I both commented on
> it, asking for a backport to 2.0.x...on that note, anyone with commit
> access want to backport https://issues.apache.org/struts/browse/WW-2170
> and release 2.0.12? The patch is there and ready to go)  :-)
> 
> What I'm not sure how to do is to get the error messages into the
> redirect url, and it seems like something you'd want often enough for it
> to be built-in to ServletActionRedirectResult (or a class which extends
> it).
> 
> Brad Cupit
> Louisiana State University - UIS
> 
> 
> -Original Message-
> From: Guillaume Bilodeau [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, April 10, 2008 1:24 PM
> To: user@struts.apache.org
> Subject: RE: interesting proxy + action chain issue
> 
> 
> Hi Brad,
> 
> Have you tried this:
> http://www.vitarara.org/cms/struts_2_cookbook/post_and_redirect
> 
> I've used this for a while with good results, although recently I've
> stumbled on WW-2170 ( https://issues.apache.org/struts/browse/WW-2170 ).
> It
> seems to occur only when using annotations though.
> 
> Cheers,
> GB
> 
> 
> Brad A Cupit wrote:
>> 
>> The only problem with the scope plugin is that it will use the
> session,
>> which may break the whole notion of POST-redirect-GET: if the data in
>> the session is removed or replaced by later requests, then pressing
> the
>> back or refresh buttons on the initial page with errors will not yield
>> the same response.
>> 
>> I think it would be cool if the errors were url parameters as part of
>> the redirect, but there's currently no easy way to do this. Could a
>> custom interceptor realize that the result is a redirect and turn the
>> validation errors into url parameters? Or would this need to be a
> custom
>> result class (perhaps extending ServletRedirectResult or
>> ServletActionRedirectResult)?
>> 
>> Brad Cupit
>> Louisiana State University - UIS
>> 
>> -Original Message-
>> From: Jeromy Evans [mailto:[EMAIL PROTECTED] 
>> Sent: Tuesday, April 08, 2008 6:24 PM
>> To: Struts Users Mailing List
>> Subject: Re: interesting proxy + action chain issue
>> 
>> Ian Meikle wrote:
>>> HI,
>>>
>>> I have been following this post with interest since I used the PRG
>> pattern 
>>> in previous projects.
>>> We are using struts 2 in are current project and I like the
>> errorMessages 
>>> behaviour that is part of the Action.
>>>
>>> Is it possible to persist these over the PRG cycle ?
>>> By default I assume they would be lost when we get to the GET stage
>> since 
>>> they are request scope and the GET is a seperate request than the
> POST
>> 
>>> that caused  the error.
>>>
>>>   
>> 
>> Hi Ian,
>> This is an issue that Struts2 needs to handle better.  It can be done 
>> but its not as straight-forward as it could be.
>> 
>> The scope interceptor [1] provides this feature. It allows you to 
>> specify which properties should be bound to session or application
> scope
>> 
>> and injected into the action.
>> The scoped modeldriven interceptor is for modeldriven actions [2].
> Both
>> 
>> are included in the default stack.
>> 
>> The scope plugin allows annotations to specify which properties
> persist 
>> over a cycle.  It's not bundled with struts but I have heard good 
>> comments about it [4].
>> 
>> [1] http://cwiki.apache.org/WW/scope-interceptor.html
>> [2] http://cwiki.apache.org/WW/scoped-model-driven-interceptor.html
>> [3] http://cwiki.apache.org/S2PLUGINS/scope-plugin.html
>> [4] http://article.gmane.org/gmane.comp.jakarta.struts.devel/65052
>> 
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> 

RE: interesting proxy + action chain issue

2008-04-10 Thread Brad A Cupit
Hi Guillaume,
yep, I'm familiar with the ServletActionRedirectResult, and I'm
especially familiar with bug you mentioned (you and I both commented on
it, asking for a backport to 2.0.x...on that note, anyone with commit
access want to backport https://issues.apache.org/struts/browse/WW-2170
and release 2.0.12? The patch is there and ready to go)  :-)

What I'm not sure how to do is to get the error messages into the
redirect url, and it seems like something you'd want often enough for it
to be built-in to ServletActionRedirectResult (or a class which extends
it).

Brad Cupit
Louisiana State University - UIS


-Original Message-
From: Guillaume Bilodeau [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 10, 2008 1:24 PM
To: user@struts.apache.org
Subject: RE: interesting proxy + action chain issue


Hi Brad,

Have you tried this:
http://www.vitarara.org/cms/struts_2_cookbook/post_and_redirect

I've used this for a while with good results, although recently I've
stumbled on WW-2170 ( https://issues.apache.org/struts/browse/WW-2170 ).
It
seems to occur only when using annotations though.

Cheers,
GB


Brad A Cupit wrote:
> 
> The only problem with the scope plugin is that it will use the
session,
> which may break the whole notion of POST-redirect-GET: if the data in
> the session is removed or replaced by later requests, then pressing
the
> back or refresh buttons on the initial page with errors will not yield
> the same response.
> 
> I think it would be cool if the errors were url parameters as part of
> the redirect, but there's currently no easy way to do this. Could a
> custom interceptor realize that the result is a redirect and turn the
> validation errors into url parameters? Or would this need to be a
custom
> result class (perhaps extending ServletRedirectResult or
> ServletActionRedirectResult)?
> 
> Brad Cupit
> Louisiana State University - UIS
> 
> -Original Message-
> From: Jeromy Evans [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, April 08, 2008 6:24 PM
> To: Struts Users Mailing List
> Subject: Re: interesting proxy + action chain issue
> 
> Ian Meikle wrote:
>> HI,
>>
>> I have been following this post with interest since I used the PRG
> pattern 
>> in previous projects.
>> We are using struts 2 in are current project and I like the
> errorMessages 
>> behaviour that is part of the Action.
>>
>> Is it possible to persist these over the PRG cycle ?
>> By default I assume they would be lost when we get to the GET stage
> since 
>> they are request scope and the GET is a seperate request than the
POST
> 
>> that caused  the error.
>>
>>   
> 
> Hi Ian,
> This is an issue that Struts2 needs to handle better.  It can be done 
> but its not as straight-forward as it could be.
> 
> The scope interceptor [1] provides this feature. It allows you to 
> specify which properties should be bound to session or application
scope
> 
> and injected into the action.
> The scoped modeldriven interceptor is for modeldriven actions [2].
Both
> 
> are included in the default stack.
> 
> The scope plugin allows annotations to specify which properties
persist 
> over a cycle.  It's not bundled with struts but I have heard good 
> comments about it [4].
> 
> [1] http://cwiki.apache.org/WW/scope-interceptor.html
> [2] http://cwiki.apache.org/WW/scoped-model-driven-interceptor.html
> [3] http://cwiki.apache.org/S2PLUGINS/scope-plugin.html
> [4] http://article.gmane.org/gmane.comp.jakarta.struts.devel/65052
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context:
http://www.nabble.com/interesting-proxy-%2B-action-chain-issue-tp1654447
2p16612701.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: interesting proxy + action chain issue

2008-04-10 Thread Guillaume Bilodeau

Hi Brad,

Have you tried this:
http://www.vitarara.org/cms/struts_2_cookbook/post_and_redirect

I've used this for a while with good results, although recently I've
stumbled on WW-2170 ( https://issues.apache.org/struts/browse/WW-2170 ).  It
seems to occur only when using annotations though.

Cheers,
GB


Brad A Cupit wrote:
> 
> The only problem with the scope plugin is that it will use the session,
> which may break the whole notion of POST-redirect-GET: if the data in
> the session is removed or replaced by later requests, then pressing the
> back or refresh buttons on the initial page with errors will not yield
> the same response.
> 
> I think it would be cool if the errors were url parameters as part of
> the redirect, but there's currently no easy way to do this. Could a
> custom interceptor realize that the result is a redirect and turn the
> validation errors into url parameters? Or would this need to be a custom
> result class (perhaps extending ServletRedirectResult or
> ServletActionRedirectResult)?
> 
> Brad Cupit
> Louisiana State University - UIS
> 
> -Original Message-
> From: Jeromy Evans [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, April 08, 2008 6:24 PM
> To: Struts Users Mailing List
> Subject: Re: interesting proxy + action chain issue
> 
> Ian Meikle wrote:
>> HI,
>>
>> I have been following this post with interest since I used the PRG
> pattern 
>> in previous projects.
>> We are using struts 2 in are current project and I like the
> errorMessages 
>> behaviour that is part of the Action.
>>
>> Is it possible to persist these over the PRG cycle ?
>> By default I assume they would be lost when we get to the GET stage
> since 
>> they are request scope and the GET is a seperate request than the POST
> 
>> that caused  the error.
>>
>>   
> 
> Hi Ian,
> This is an issue that Struts2 needs to handle better.  It can be done 
> but its not as straight-forward as it could be.
> 
> The scope interceptor [1] provides this feature. It allows you to 
> specify which properties should be bound to session or application scope
> 
> and injected into the action.
> The scoped modeldriven interceptor is for modeldriven actions [2].  Both
> 
> are included in the default stack.
> 
> The scope plugin allows annotations to specify which properties persist 
> over a cycle.  It's not bundled with struts but I have heard good 
> comments about it [4].
> 
> [1] http://cwiki.apache.org/WW/scope-interceptor.html
> [2] http://cwiki.apache.org/WW/scoped-model-driven-interceptor.html
> [3] http://cwiki.apache.org/S2PLUGINS/scope-plugin.html
> [4] http://article.gmane.org/gmane.comp.jakarta.struts.devel/65052
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/interesting-proxy-%2B-action-chain-issue-tp16544472p16612701.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: interesting proxy + action chain issue

2008-04-10 Thread Brad A Cupit
The only problem with the scope plugin is that it will use the session,
which may break the whole notion of POST-redirect-GET: if the data in
the session is removed or replaced by later requests, then pressing the
back or refresh buttons on the initial page with errors will not yield
the same response.

I think it would be cool if the errors were url parameters as part of
the redirect, but there's currently no easy way to do this. Could a
custom interceptor realize that the result is a redirect and turn the
validation errors into url parameters? Or would this need to be a custom
result class (perhaps extending ServletRedirectResult or
ServletActionRedirectResult)?

Brad Cupit
Louisiana State University - UIS

-Original Message-
From: Jeromy Evans [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 08, 2008 6:24 PM
To: Struts Users Mailing List
Subject: Re: interesting proxy + action chain issue

Ian Meikle wrote:
> HI,
>
> I have been following this post with interest since I used the PRG
pattern 
> in previous projects.
> We are using struts 2 in are current project and I like the
errorMessages 
> behaviour that is part of the Action.
>
> Is it possible to persist these over the PRG cycle ?
> By default I assume they would be lost when we get to the GET stage
since 
> they are request scope and the GET is a seperate request than the POST

> that caused  the error.
>
>   

Hi Ian,
This is an issue that Struts2 needs to handle better.  It can be done 
but its not as straight-forward as it could be.

The scope interceptor [1] provides this feature. It allows you to 
specify which properties should be bound to session or application scope

and injected into the action.
The scoped modeldriven interceptor is for modeldriven actions [2].  Both

are included in the default stack.

The scope plugin allows annotations to specify which properties persist 
over a cycle.  It's not bundled with struts but I have heard good 
comments about it [4].

[1] http://cwiki.apache.org/WW/scope-interceptor.html
[2] http://cwiki.apache.org/WW/scoped-model-driven-interceptor.html
[3] http://cwiki.apache.org/S2PLUGINS/scope-plugin.html
[4] http://article.gmane.org/gmane.comp.jakarta.struts.devel/65052

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: interesting proxy + action chain issue

2008-04-08 Thread Jeromy Evans

Ian Meikle wrote:

HI,

I have been following this post with interest since I used the PRG pattern 
in previous projects.
We are using struts 2 in are current project and I like the errorMessages 
behaviour that is part of the Action.


Is it possible to persist these over the PRG cycle ?
By default I assume they would be lost when we get to the GET stage since 
they are request scope and the GET is a seperate request than the POST 
that caused  the error.


  


Hi Ian,
This is an issue that Struts2 needs to handle better.  It can be done 
but its not as straight-forward as it could be.


The scope interceptor [1] provides this feature. It allows you to 
specify which properties should be bound to session or application scope 
and injected into the action.
The scoped modeldriven interceptor is for modeldriven actions [2].  Both 
are included in the default stack.


The scope plugin allows annotations to specify which properties persist 
over a cycle.  It's not bundled with struts but I have heard good 
comments about it [4].


[1] http://cwiki.apache.org/WW/scope-interceptor.html
[2] http://cwiki.apache.org/WW/scoped-model-driven-interceptor.html
[3] http://cwiki.apache.org/S2PLUGINS/scope-plugin.html
[4] http://article.gmane.org/gmane.comp.jakarta.struts.devel/65052

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: interesting proxy + action chain issue

2008-04-08 Thread Ian Meikle
HI,

I have been following this post with interest since I used the PRG pattern 
in previous projects.
We are using struts 2 in are current project and I like the errorMessages 
behaviour that is part of the Action.

Is it possible to persist these over the PRG cycle ?
By default I assume they would be lost when we get to the GET stage since 
they are request scope and the GET is a seperate request than the POST 
that caused  the error.

Regards
Ian

CSC Solutions Norge AS
Registered Office: SandsliƄsen 57, 5254 Sandsli, Norway 
Registered in Norway No: 958 958 455

-
This is a PRIVATE message. If you are not the intended recipient, please 
delete without copying and kindly advise us by e-mail of the mistake in 
delivery. 
NOTE: Regardless of content, this e-mail shall not operate to bind CSC to 
any order or other contract unless pursuant to explicit written agreement 
or government initiative expressly permitting the use of e-mail for such 
purpose.
-




"Brad A Cupit" <[EMAIL PROTECTED]> 
08.04.2008 17:16
Please respond to
"Struts Users Mailing List" 


To
"Struts Users Mailing List" 
cc

Subject
RE: interesting proxy + action chain issue






Oh thank you so much for the response. I've been reading about the
POST-redirect-GET pattern and I'm starting to see the light. I found the
original article here, in case anyone else is interested:

http://www.theserverside.com/tt/articles/article.tss?l=RedirectAfterPost

Brad Cupit
Louisiana State University - UIS


-Original Message-
From: Jeromy Evans [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 07, 2008 8:20 PM
To: Struts Users Mailing List
Subject: Re: interesting proxy + action chain issue

Brad A Cupit wrote:
> ServletActionRedirectResult worked when I used it instead of the
> ActionChainResult. This performs an extra round trip back to the
> browser, which isn't terrible unless I want to pass data from one
Action
> to another, and herein lies some concern.
> ...
>
> POSTS should each have their own Action (which may write the data to
the
> DB). This Action should only process the POST. Afterwards, it forwards
> (chains) to another Action, which sits in front of the view. If the
view
> needs data from the DB, it goes in the Action for that view (not the
> POST-handling Action). If the view doesn't need data, then the Action
is
> dumb and just forwards to the view.
>
> 

The reason the post-redirect-get pattern is typically preferred over 
your approach is for handling of the browser's back button.
By returning a redirect the browser is prevented from reposting 
data/showing a warning if the user presses back. 

Your approach is clearly more efficient as it removes a request-response

cycle, but unfortunately the repost issue usually supersedes that.

>
> Seems like a nice design, but Action chaining isn't recommended, and
> isn't working with CGLIB proxies  :-(
>
> 

The main argument for discouraging action chaining is simply to reduce 
coupling between actions.  I didn't realise Ognl was performing a copy.

I thought the next action was
simply pushed onto the stack above the previous action allowing you to 
access the properties of the previous action.  I guess I'm wrong. 

You may have stumbled upon another reason to discourage use of chaining.




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: interesting proxy + action chain issue

2008-04-08 Thread Brad A Cupit
Oh thank you so much for the response. I've been reading about the
POST-redirect-GET pattern and I'm starting to see the light. I found the
original article here, in case anyone else is interested:

http://www.theserverside.com/tt/articles/article.tss?l=RedirectAfterPost

Brad Cupit
Louisiana State University - UIS


-Original Message-
From: Jeromy Evans [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 07, 2008 8:20 PM
To: Struts Users Mailing List
Subject: Re: interesting proxy + action chain issue

Brad A Cupit wrote:
> ServletActionRedirectResult worked when I used it instead of the
> ActionChainResult. This performs an extra round trip back to the
> browser, which isn't terrible unless I want to pass data from one
Action
> to another, and herein lies some concern.
> ...
>
> POSTS should each have their own Action (which may write the data to
the
> DB). This Action should only process the POST. Afterwards, it forwards
> (chains) to another Action, which sits in front of the view. If the
view
> needs data from the DB, it goes in the Action for that view (not the
> POST-handling Action). If the view doesn't need data, then the Action
is
> dumb and just forwards to the view.
>
>   

The reason the post-redirect-get pattern is typically preferred over 
your approach is for handling of the browser's back button.
By returning a redirect the browser is prevented from reposting 
data/showing a warning if the user presses back. 

Your approach is clearly more efficient as it removes a request-response

cycle, but unfortunately the repost issue usually supersedes that.

>
> Seems like a nice design, but Action chaining isn't recommended, and
> isn't working with CGLIB proxies  :-(
>
>   

The main argument for discouraging action chaining is simply to reduce 
coupling between actions.  I didn't realise Ognl was performing a copy.

I thought the next action was
simply pushed onto the stack above the previous action allowing you to 
access the properties of the previous action.  I guess I'm wrong. 

You may have stumbled upon another reason to discourage use of chaining.




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: interesting proxy + action chain issue

2008-04-07 Thread Jeromy Evans

Jeromy Evans wrote:

Brad A Cupit wrote:

...

POSTS should each have their own Action (which may write the data to the
DB). This Action should only process the POST. Afterwards, it forwards
(chains) to another Action, which sits in front of the view. If the view
needs data from the DB, it goes in the Action for that view (not the
POST-handling Action). If the view doesn't need data, then the Action is
dumb and just forwards to the view.

  


The reason the post-redirect-get pattern is typically preferred over 
your approach is for handling of the browser's back button.
By returning a redirect the browser is prevented from reposting 
data/showing a warning if the user presses back.
Your approach is clearly more efficient as it removes a 
request-response cycle, but unfortunately the repost issue usually 
supersedes that.






I thought I'd add that a way to overcome this in modern browsers is to 
perform all posts via an asynchronous request.  The POST returns a 
pass/fail response and the client then determines which action to take 
(eg. update the DOM, render the post response, perform a GET) etc.


Prasad, Taneja & Todankar's paper "Life Above the Service Tier" [1] 
contains a good description of the problem.


[1] http://wisdomofganesh.blogspot.com/2007/10/life-above-service-tier.html




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: interesting proxy + action chain issue

2008-04-07 Thread Jeromy Evans

Brad A Cupit wrote:

ServletActionRedirectResult worked when I used it instead of the
ActionChainResult. This performs an extra round trip back to the
browser, which isn't terrible unless I want to pass data from one Action
to another, and herein lies some concern.
...

POSTS should each have their own Action (which may write the data to the
DB). This Action should only process the POST. Afterwards, it forwards
(chains) to another Action, which sits in front of the view. If the view
needs data from the DB, it goes in the Action for that view (not the
POST-handling Action). If the view doesn't need data, then the Action is
dumb and just forwards to the view.

  


The reason the post-redirect-get pattern is typically preferred over 
your approach is for handling of the browser's back button.
By returning a redirect the browser is prevented from reposting 
data/showing a warning if the user presses back. 

Your approach is clearly more efficient as it removes a request-response 
cycle, but unfortunately the repost issue usually supersedes that.




Seems like a nice design, but Action chaining isn't recommended, and
isn't working with CGLIB proxies  :-(

  


The main argument for discouraging action chaining is simply to reduce 
coupling between actions.  I didn't realise Ognl was performing a copy.  
I thought the next action was
simply pushed onto the stack above the previous action allowing you to 
access the properties of the previous action.  I guess I'm wrong. 


You may have stumbled upon another reason to discourage use of chaining.




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: interesting proxy + action chain issue

2008-04-07 Thread Brad A Cupit
ServletActionRedirectResult worked when I used it instead of the
ActionChainResult. This performs an extra round trip back to the
browser, which isn't terrible unless I want to pass data from one Action
to another, and herein lies some concern.

Here's my design, and if you guys think it's flawed I'm certainly
willing to take criticism!

GETs are simple: just an Action that does some work and forwards to the
view.

POSTS should each have their own Action (which may write the data to the
DB). This Action should only process the POST. Afterwards, it forwards
(chains) to another Action, which sits in front of the view. If the view
needs data from the DB, it goes in the Action for that view (not the
POST-handling Action). If the view doesn't need data, then the Action is
dumb and just forwards to the view.

No direct links are made to JSPs, instead they link to the associated
Action. We can make exceptions for very simple views that are tied to
the POST (like a confirmation page), maybe it wouldn't need two Actions.

The advantage of this is two-fold:
a) if we ever need to make a 'dumb' action do DB lookups, we don't have
to change any links, just the dumb Action
b) we can reuse any JSP easily since all DB operations for it are
performed by its associated Action

Seems like a nice design, but Action chaining isn't recommended, and
isn't working with CGLIB proxies  :-(

p.s. the codebehind plugin makes it so we don't have to write those dumb
actions. Nice!!

Brad Cupit
Louisiana State University - UIS

-Original Message-
From: Brad A Cupit 
Sent: Monday, April 07, 2008 11:10 AM
To: 'user@struts.apache.org'
Subject: interesting proxy + action chain issue

Hi! I'm having a very interesting issue with CGLIB proxies. I'm proxying
my actions with Spring AOP (to get declarative transactions on each
Action).

Everything is working great, except when I try action chaining, I get a
class cast exception that Action2 can't be cast to Action1 (Action1 is
first in the chain).

This was very unusual, so I investigated. Here's what I found:

OgnlUtil.copy() is calling all of the getters in Action1 and pumping
that data into setters on Action2. With CGLIB, it calls getCallbacks()
and setCallbacks(), two methods created by CGLIB. This results in
Action2 having Action1's callbacks. Basically, it's similar to the
Action2 proxy referencing the Action1 target!

I can't use JDK proxies because the getters on my action (whose values
will be part of the value stack) are not defined on any interfaces, so
reflection on a JDK proxy will not find those getters.

I have a few ideas for workarounds, but I'd like to ask: has anyone else
seen this? Am I the first to try CGLIB proxies and Action chaining?

I've also read that action chaining is discouraged, but I don't
understand why. Maybe a completely different approach would work better?

Thanks!

Brad Cupit
Louisiana State University - UIS


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



interesting proxy + action chain issue

2008-04-07 Thread Brad A Cupit
Hi! I'm having a very interesting issue with CGLIB proxies. I'm proxying
my actions with Spring AOP (to get declarative transactions on each
Action).

Everything is working great, except when I try action chaining, I get a
class cast exception that Action2 can't be cast to Action1 (Action1 is
first in the chain).

This was very unusual, so I investigated. Here's what I found:

OgnlUtil.copy() is calling all of the getters in Action1 and pumping
that data into setters on Action2. With CGLIB, it calls getCallbacks()
and setCallbacks(), two methods created by CGLIB. This results in
Action2 having Action1's callbacks. Basically, it's similar to the
Action2 proxy referencing the Action1 target!

I can't use JDK proxies because the getters on my action (whose values
will be part of the value stack) are not defined on any interfaces, so
reflection on a JDK proxy will not find those getters.

I have a few ideas for workarounds, but I'd like to ask: has anyone else
seen this? Am I the first to try CGLIB proxies and Action chaining?

I've also read that action chaining is discouraged, but I don't
understand why. Maybe a completely different approach would work better?

Thanks!

Brad Cupit
Louisiana State University - UIS


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Display the list of values in check box - Interesting problem

2007-07-06 Thread banurekha

I am using iterator to display list in bean with check boxas below

 



   



 
 

 


I want to get the value for the ones which are select one they are submit.
For that I am using the below java script

function showChecked(selItems) 
{
  var thetable = document.getElementById('mktselect');
  var data="";
  var cableid="";
  var theform = document.cableHeadends;
  var tot = theform.elements.length;
  for (i=0; ihttp://www.nabble.com/Display-the-list-of-values-in-check-box---Interesting-problem-tf4039222.html#a11475627
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Interesting question (to me)... Perl app conversion to SUNWappserver/Java/Struts

2006-05-16 Thread C. Grobmeier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Cheers,

Alan Treece wrote:
> As the Subject: line states I'm in the middle of converting a larger
> Perl application to a Struts web-app running on the SUNWappserver. The
> question was posed as to how to deal with all of the folks who may have
> "bookmarked" a perl URL to the old app. I don't want to just cut those
> folks off when the switch is made.
> 
> Are there any tricks folks have used to deal with this scenario? The
> goal is to turn off the perl app and start the Struts web-app with the
> same server name and port.

i had to turn off an php-application. If you are using the apache httpd
before the appserver i recommend rewriting within the vhost, for example:

RewriteCond %{QUERY_STRING}
^(feat=2&loc=reviews|loc=reviews&feat=2)&id=([0-9]+)$
RewriteRule ^/index.php$
http://www.possessed.de/details.do?content=0&id=%2 [L,R=301]

This works for Apache 1.3.x. Maybe there is similar for other
webservers, but i don't.

Hope that helps.
Regards,
Chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2.1 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEagJukv8rKBUE/T4RAlo8AJ4+AJwnmeoHsROMD7oXpg5bAHtdXgCeNSoB
uNXxm9OTmDZJabrzDYq76rI=
=RXhc
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Interesting question (to me)... Perl app conversion to SUNWappserver/Java/Struts

2006-05-12 Thread Danny Lee

Use URL rewrite filter for this one. It's really a good stuff.

https://urlrewrite.dev.java.net/

Cheers,

Danny



Alan Treece wrote:
As the Subject: line states I'm in the middle of converting a larger 
Perl application to a Struts web-app running on the SUNWappserver. The 
question was posed as to how to deal with all of the folks who may have 
"bookmarked" a perl URL to the old app. I don't want to just cut those 
folks off when the switch is made.


Are there any tricks folks have used to deal with this scenario? The 
goal is to turn off the perl app and start the Struts web-app with the 
same server name and port.



Thanks, ajTreece



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Interesting question (to me)... Perl app conversion to SUNWappserver/Java/Struts

2006-05-09 Thread Dave Newton
Leon Rosenberg wrote:
> Define a servletmapping for the old url, write a servlet which simply
> redirects all requests to the new url. Done.

Or filter with a list of old URLs => new URLs and redirect.

Dave



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Interesting question (to me)... Perl app conversion to SUNWappserver/Java/Struts

2006-05-09 Thread Leon Rosenberg

Define a servletmapping for the old url, write a servlet which simply
redirects all requests to the new url. Done.
regards
Leon

On 5/9/06, Alan Treece <[EMAIL PROTECTED]> wrote:

As the Subject: line states I'm in the middle of converting a larger
Perl application to a Struts web-app running on the SUNWappserver.
The question was posed as to how to deal with all of the folks who
may have "bookmarked" a perl URL to the old app. I don't want to just
cut those folks off when the switch is made.

Are there any tricks folks have used to deal with this scenario? The
goal is to turn off the perl app and start the Struts web-app with
the same server name and port.


Thanks, ajTreece


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Interesting question (to me)... Perl app conversion to SUNWappserver/Java/Struts

2006-05-09 Thread Gareth Evans

Hi,

You could use a servlet mapped to *.pl (or whatever extension the perl 
system used) and get it to send a redirect to the appropriate part of 
the java system.


Gareth

Alan Treece wrote:
As the Subject: line states I'm in the middle of converting a larger 
Perl application to a Struts web-app running on the SUNWappserver. The 
question was posed as to how to deal with all of the folks who may have 
"bookmarked" a perl URL to the old app. I don't want to just cut those 
folks off when the switch is made.


Are there any tricks folks have used to deal with this scenario? The 
goal is to turn off the perl app and start the Struts web-app with the 
same server name and port.



Thanks, ajTreece


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Interesting question (to me)... Perl app conversion to SUNWappserver/Java/Struts

2006-05-08 Thread Alan Treece
As the Subject: line states I'm in the middle of converting a larger  
Perl application to a Struts web-app running on the SUNWappserver.  
The question was posed as to how to deal with all of the folks who  
may have "bookmarked" a perl URL to the old app. I don't want to just  
cut those folks off when the switch is made.


Are there any tricks folks have used to deal with this scenario? The  
goal is to turn off the perl app and start the Struts web-app with  
the same server name and port.



Thanks, ajTreece


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Interesting!

2005-11-23 Thread James Mitchell
Besides the fact that MessageResources was never intended to be changed at 
runtime, what will you do if you deploy on a server that throws away 
previous exploded WARs like JBoss?  On restart, you just lost those changes.


If you need a dynamic bundle, consider using a database-backed 
MessageResources implementation.  While still somewhat of a hack, at least 
your changes can be persisted in a consistent and safe manner.




--
James Mitchell
Software Engineer / Open Source Evangelist
Consulting / Mentoring / Freelance
EdgeTech, Inc.
http://www.edgetechservices.net/
678.910.8017
AIM:   jmitchtx
MSN:   [EMAIL PROTECTED]
Skype: jmitchtx

- Original Message - 
From: "Shailesh Barde" <[EMAIL PROTECTED]>

To: 
Sent: Wednesday, November 23, 2005 2:26 AM
Subject: Interesting!



Hello Friends,

I have developed a module in my Project to Make changes in the resource 
Bundle (.properties) file at RunTime by Using java.io.After Writing on a 
File(Through Action Action Class) the web Server gets Restarted & the 
updated Resource Bundle is Displayed on a JSP.(after Refreshing that Page)
 As the Web Server gets started for Every change I have made,i have stored 
the entire changes in a Temporary File (which is different from my current 
Resource Bundle properties).
  My Intention is to load that file(temporary file) Through Action 
Servlet(we are having extended Action Servlet of ours in Application).How 
can i do this?


  Please Guide!


Regards,

Shailesh Barde



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Interesting!

2005-11-22 Thread Shailesh Barde
 Ā 
Hello Friends,

I have developed a module in my Project to Make changes in the resource Bundle 
(.properties) file at RunTime by Using java.io.After Writing on a File(Through 
Action Action Class) the web Server gets Restarted & the updated Resource 
Bundle is Displayed on a JSP.(after Refreshing that Page)
  As the Web Server gets started for Every change I have made,i have stored the 
entire changes in a Temporary File (which is different from my current Resource 
Bundle properties).
   My Intention is to load that file(temporary file) Through Action Servlet(we 
are having extended Action Servlet of ours in Application).How can i do this?

   Please Guide!


Regards,

Shailesh Barde
  

[OR] Re: Interesting problem...

2005-03-18 Thread Dakota Jack
///;-)


On Fri, 18 Mar 2005 13:22:01 -0500 (EST), Frank W. Zammetti
<[EMAIL PROTECTED]> wrote:
> I've wanted a nickname all my life (aside from the explicitives some would
> use!)... never thought it's be Radar :)
> 
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> 
> On Fri, March 18, 2005 1:09 pm, Dakota Jack said:
> > The class works, but I don't think it is what you want.  Maybe it is.
> > Just don't have high expectations.  I did and was disappointed.  Just
> > trying to help you out, Radar!  ///;-)
> >
> > Jack



-- 
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Interesting problem...

2005-03-18 Thread Rick Reumann
I posed your question to a colleague of mine, because this problem is 
way beyond my puny knowledge. Anyway, his response, for what it's worth:

>
My first instinct is to call this a Supremely Bad Idea.  There WILL be
conflicts.  You can bet on it.  Best to have a single "maintenance"
process on a single host that fails over as needed.  Alternatively, rely
on shared/exclusive table-level locking which is extremely efficient,
widely supported, and does not suffer from the issues that row-level
locking is famous for.
If the random number generator is still insisted upon, there are
standard solutions for seeding it.  The java.security.SecureRandom class
uses host and network performance and latency metrics to seed itself.
While that might not be quite as well-seeded as a "pot of boiling
water", it's pretty darn close.
If that's not sufficient and you're running on a UNIX-style system
(Linux, BSD, Solaris, etc), you can read a block from /dev/random and
seed your generator with that.  It's a system-level random state that
survives reboot.
Finally, you can seed it with a UUID.  Most containers these days
provide some sort of UUID service, and if not then there are example
UUID generators all over the net.
<

Frank W. Zammetti wrote the following on 3/18/2005 10:35 AM:
Oh boy, I got a good one!  It's only related to Struts in that the
application in question is Struts-based, so I hope no one minds a semi-OT
question...
Here's the situation... An app I wrote has a daemon thread that is spawned
at startup (from a Struts plugin) that does periodic background processing
tasks.  This works great, never had a bit of trouble.
Now though, the app is moving from a single server to a clusted environment.
So, what's going to happen is that each server in the cluster will have
its own instance of the thread running on it.  Not a huge problem except
that I have to be sure only one instance of the thread (i.e., one server
in the cluster) is executing concurrently.
The easy solution is just a database table that is checked when the thread
wakes up.  If there is no entry in it, then there is no other instance
running, so it can write an entry to the table and go off and do its
thing.
I want to be extremely certain that no issues arise in terms of one
instance of the thread reading from the database while another instance is
writing, etc.  So, aside from transactional database calls and row-level
locking, I want to do one more thing: I want the thread to sleep a random
number of seconds (1-300) at startup.  This will ensure that, all the
database locking and such aside, the threads should all be offset from one
another in terms of when they run.
So, I need a random number generated when the thread starts up.  As we all
know though, random number generation on most computers that don't have
something like a Brownian motion sensor attached stuck in a cup of boiling
coffee can't generate truly random numbers.  So, in theory, what could
happen is that if all the servers in the cluster come up at the same time,
the threads could wind up running at the same time regardless of the
random sleep at the start!  It might never happen in reality, small
fluctuations would probably offset them anyway, but I want to be more
certain than that.
So now we're at the crux of the problem...
I can't just seed the random number generator with the current time
because it concievably might not be random enough.  So, I thought I could
just tally up the octets of the server's IP address and add that to the
current time.  Then the seed on each server should be different enough.
But, there doesn't appear to be any way to get the server IP address
independant of a request, so I can't get at it in my plugin.  Anyone know
differently?
Assuming that is the case, can anyone think of any other way to seed the
generator that would ensure a different value on different machines in the
cluster?  There are some options like encoding the individual server names
in my app's config file with a different seed value for each, but that
makes maintenance a pain if a new server is added or one removed or
addresses simply changed.
Any ideas?  Thanks!

--
Rick
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


[MASSIVELY OT AT THIS POINT] Re: Interesting problem...

2005-03-18 Thread Frank W. Zammetti
On Fri, March 18, 2005 1:46 pm, Kris Schneider said:
> Actually, I was thinking more along the lines of Radar's precog abilities.
> So,
> if you weren't aware the nick was coming, then it obviously doesn't fit
> ;-).
> Anyway, for better or worse, you've already got a namesake from the show.
> All
> we can hope for you is that you've got your own real-life Hot
> Lips...whatever
> form that may take... ;-)

Ah, didn't catch that.  Very clever! :)

Actually, I always found Hot Lips rather unattractive, except in the movie
where she was quite nice for sure.  Not on the show though.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Interesting problem...

2005-03-18 Thread Kris Schneider
Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:

> On Fri, March 18, 2005 1:30 pm, Kris Schneider said:
> > Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:
> >
> >> I've wanted a nickname all my life (aside from the explicitives some
> >> would
> >> use!)... never thought it's be Radar :)
> >
> > Then it probably shouldn't be ;-)
> 
> Oh no, I opened my mouth with regard to my typing prowess of my own
> volition, and that was the catalyst for Radar so now I gotta suffer with
> it 'till the day I die. :)  I can blame no one but myself!

Actually, I was thinking more along the lines of Radar's precog abilities. So,
if you weren't aware the nick was coming, then it obviously doesn't fit ;-).
Anyway, for better or worse, you've already got a namesake from the show. All
we can hope for you is that you've got your own real-life Hot Lips...whatever
form that may take... ;-)

> I don't mind... the only problem is now I gotta go get all new business
> cards printed up :)
> 
> -- 
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com

-- 
Kris Schneider 
D.O.Tech   

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Interesting problem...

2005-03-18 Thread Frank W. Zammetti
On Fri, March 18, 2005 1:30 pm, Kris Schneider said:
> Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:
>
>> I've wanted a nickname all my life (aside from the explicitives some
>> would
>> use!)... never thought it's be Radar :)
>
> Then it probably shouldn't be ;-)

Oh no, I opened my mouth with regard to my typing prowess of my own
volition, and that was the catalyst for Radar so now I gotta suffer with
it 'till the day I die. :)  I can blame no one but myself!

I don't mind... the only problem is now I gotta go get all new business
cards printed up :)

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Interesting problem...

2005-03-18 Thread Kris Schneider
Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:

> I've wanted a nickname all my life (aside from the explicitives some would
> use!)... never thought it's be Radar :)

Then it probably shouldn't be ;-)

> -- 
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> 
> On Fri, March 18, 2005 1:09 pm, Dakota Jack said:
> > The class works, but I don't think it is what you want.  Maybe it is.
> > Just don't have high expectations.  I did and was disappointed.  Just
> > trying to help you out, Radar!  ///;-)
> >
> > Jack
> >
> >
> > On Fri, 18 Mar 2005 12:21:28 -0500 (EST), Frank W. Zammetti
> > <[EMAIL PROTECTED]> wrote:
> >> Why do you think it wouldn't work?  Does it sometimes return incorrect
> >> information in some setups?
> >>
> >> I thought of doing some kind of mini-browser-type thing, but before I go
> >> down that road I wanted to explore some simpler solutions.  The Commons
> >> ID
> >> thing is very nice, but I'm not so sure I'm comfortable putting in
> >> something that isn't actually released yet.
> >>
> >> That being said, what was on the site for it got me to thinking... I
> >> think
> >> if I do a combination of the sum of the MAC address digits + the current
> >> time + the hashCode of the IP address, that is probably as random as I
> >> need.  But, if you know something about InetAddress that would make this
> >> not work, I'm all ears :)
> >>
> >> Of course, I'm not sure how to get the MAC address yet, but one problem
> >> at
> >> a time...
> >>
> >> --
> >> Frank W. Zammetti
> >> Founder and Chief Software Architect
> >> Omnytex Technologies
> >> http://www.omnytex.com
> >>
> >> On Fri, March 18, 2005 12:14 pm, Dakota Jack said:
> >> > InetAddress might not get the answer for you, Frank.  I don't know
> >> > what your setup is, but you can go to any ip address service outside
> >> > your system and get a unique return address for your machines with a
> >> > mini-browser.
> >> >
> >> > Jack
> >> >
> >> >
> >> > On Fri, 18 Mar 2005 11:36:10 -0500 (EST), Frank W. Zammetti
> >> > <[EMAIL PROTECTED]> wrote:
> >> >> Yes, I think InetAddress just might do the trick.  Thank you Kris!
> >> >>
> >> >> --
> >> >> Frank W. Zammetti
> >> >> Founder and Chief Software Architect
> >> >> Omnytex Technologies
> >> >> http://www.omnytex.com
> >> >>
> >> >> On Fri, March 18, 2005 11:24 am, Kris Schneider said:
> >> >> > Will InetAddress.getLocalHost() work for you?
> >> >> > NetworkInterface.getNetworkInterfaces() might also be of interest.
> >> Or,
> >> >> you
> >> >> > might want to create yourself an instance of java.rmi.dgc.VMID...
> >> >> >
> >> >> > Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:
> >> >> >
> >> >> >> Oh boy, I got a good one!  It's only related to Struts in that the
> >> >> >> application in question is Struts-based, so I hope no one minds a
> >> >> >> semi-OT
> >> >> >> question...
> >> >> >>
> >> >> >> Here's the situation... An app I wrote has a daemon thread that is
> >> >> >> spawned
> >> >> >> at startup (from a Struts plugin) that does periodic background
> >> >> >> processing
> >> >> >> tasks.  This works great, never had a bit of trouble.
> >> >> >>
> >> >> >> Now though, the app is moving from a single server to a clusted
> >> >> >> environment.
> >> >> >>
> >> >> >> So, what's going to happen is that each server in the cluster will
> >> >> have
> >> >> >> its own instance of the thread running on it.  Not a huge problem
> >> >> except
> >> >> >> that I have to be sure only one instance of the thread (i.e., one
> >> >> server
> >> >> >> in the cluster) is executing concurrently.
> >> >> >>
> >> >> >> The easy solution is just a database table that is checked when
> >> the
> >> >> >> thread
> >> >> >> wakes up.  If there is no entry in it, then there is no other
> >> >> instance
> >> >> >> running, so it can write an entry to the table and go off and do
> >> its
> >> >> >> thing.
> >> >> >>
> >> >> >> I want to be extremely certain that no issues arise in terms of
> >> one
> >> >> >> instance of the thread reading from the database while another
> >> >> instance
> >> >> >> is
> >> >> >> writing, etc.  So, aside from transactional database calls and
> >> >> row-level
> >> >> >> locking, I want to do one more thing: I want the thread to sleep a
> >> >> >> random
> >> >> >> number of seconds (1-300) at startup.  This will ensure that, all
> >> the
> >> >> >> database locking and such aside, the threads should all be offset
> >> >> from
> >> >> >> one
> >> >> >> another in terms of when they run.
> >> >> >>
> >> >> >> So, I need a random number generated when the thread starts up.
> >> As
> >> >> we
> >> >> >> all
> >> >> >> know though, random number generation on most computers that don't
> >> >> have
> >> >> >> something like a Brownian motion sensor attached stuck in a cup of
> >> >> >> boiling
> >> >> >> coffee can't generate truly random numbers.  So, in theory, what
> >> >> could
> >> >> >> happen is that if all the se

Re: Interesting problem...

2005-03-18 Thread Frank W. Zammetti
I've wanted a nickname all my life (aside from the explicitives some would
use!)... never thought it's be Radar :)

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Fri, March 18, 2005 1:09 pm, Dakota Jack said:
> The class works, but I don't think it is what you want.  Maybe it is.
> Just don't have high expectations.  I did and was disappointed.  Just
> trying to help you out, Radar!  ///;-)
>
> Jack
>
>
> On Fri, 18 Mar 2005 12:21:28 -0500 (EST), Frank W. Zammetti
> <[EMAIL PROTECTED]> wrote:
>> Why do you think it wouldn't work?  Does it sometimes return incorrect
>> information in some setups?
>>
>> I thought of doing some kind of mini-browser-type thing, but before I go
>> down that road I wanted to explore some simpler solutions.  The Commons
>> ID
>> thing is very nice, but I'm not so sure I'm comfortable putting in
>> something that isn't actually released yet.
>>
>> That being said, what was on the site for it got me to thinking... I
>> think
>> if I do a combination of the sum of the MAC address digits + the current
>> time + the hashCode of the IP address, that is probably as random as I
>> need.  But, if you know something about InetAddress that would make this
>> not work, I'm all ears :)
>>
>> Of course, I'm not sure how to get the MAC address yet, but one problem
>> at
>> a time...
>>
>> --
>> Frank W. Zammetti
>> Founder and Chief Software Architect
>> Omnytex Technologies
>> http://www.omnytex.com
>>
>> On Fri, March 18, 2005 12:14 pm, Dakota Jack said:
>> > InetAddress might not get the answer for you, Frank.  I don't know
>> > what your setup is, but you can go to any ip address service outside
>> > your system and get a unique return address for your machines with a
>> > mini-browser.
>> >
>> > Jack
>> >
>> >
>> > On Fri, 18 Mar 2005 11:36:10 -0500 (EST), Frank W. Zammetti
>> > <[EMAIL PROTECTED]> wrote:
>> >> Yes, I think InetAddress just might do the trick.  Thank you Kris!
>> >>
>> >> --
>> >> Frank W. Zammetti
>> >> Founder and Chief Software Architect
>> >> Omnytex Technologies
>> >> http://www.omnytex.com
>> >>
>> >> On Fri, March 18, 2005 11:24 am, Kris Schneider said:
>> >> > Will InetAddress.getLocalHost() work for you?
>> >> > NetworkInterface.getNetworkInterfaces() might also be of interest.
>> Or,
>> >> you
>> >> > might want to create yourself an instance of java.rmi.dgc.VMID...
>> >> >
>> >> > Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:
>> >> >
>> >> >> Oh boy, I got a good one!  It's only related to Struts in that the
>> >> >> application in question is Struts-based, so I hope no one minds a
>> >> >> semi-OT
>> >> >> question...
>> >> >>
>> >> >> Here's the situation... An app I wrote has a daemon thread that is
>> >> >> spawned
>> >> >> at startup (from a Struts plugin) that does periodic background
>> >> >> processing
>> >> >> tasks.  This works great, never had a bit of trouble.
>> >> >>
>> >> >> Now though, the app is moving from a single server to a clusted
>> >> >> environment.
>> >> >>
>> >> >> So, what's going to happen is that each server in the cluster will
>> >> have
>> >> >> its own instance of the thread running on it.  Not a huge problem
>> >> except
>> >> >> that I have to be sure only one instance of the thread (i.e., one
>> >> server
>> >> >> in the cluster) is executing concurrently.
>> >> >>
>> >> >> The easy solution is just a database table that is checked when
>> the
>> >> >> thread
>> >> >> wakes up.  If there is no entry in it, then there is no other
>> >> instance
>> >> >> running, so it can write an entry to the table and go off and do
>> its
>> >> >> thing.
>> >> >>
>> >> >> I want to be extremely certain that no issues arise in terms of
>> one
>> >> >> instance of the thread reading from the database while another
>> >> instance
>> >> >> is
>> >> >> writing, etc.  So, aside from transactional database calls and
>> >> row-level
>> >> >> locking, I want to do one more thing: I want the thread to sleep a
>> >> >> random
>> >> >> number of seconds (1-300) at startup.  This will ensure that, all
>> the
>> >> >> database locking and such aside, the threads should all be offset
>> >> from
>> >> >> one
>> >> >> another in terms of when they run.
>> >> >>
>> >> >> So, I need a random number generated when the thread starts up.
>> As
>> >> we
>> >> >> all
>> >> >> know though, random number generation on most computers that don't
>> >> have
>> >> >> something like a Brownian motion sensor attached stuck in a cup of
>> >> >> boiling
>> >> >> coffee can't generate truly random numbers.  So, in theory, what
>> >> could
>> >> >> happen is that if all the servers in the cluster come up at the
>> same
>> >> >> time,
>> >> >> the threads could wind up running at the same time regardless of
>> the
>> >> >> random sleep at the start!  It might never happen in reality,
>> small
>> >> >> fluctuations would probably offset them anyway, but I want to be
>> more
>> >> >> certain than that.
>> >> >>
>> >> 

Re: Interesting problem...

2005-03-18 Thread Dakota Jack
The class works, but I don't think it is what you want.  Maybe it is. 
Just don't have high expectations.  I did and was disappointed.  Just
trying to help you out, Radar!  ///;-)

Jack


On Fri, 18 Mar 2005 12:21:28 -0500 (EST), Frank W. Zammetti
<[EMAIL PROTECTED]> wrote:
> Why do you think it wouldn't work?  Does it sometimes return incorrect
> information in some setups?
> 
> I thought of doing some kind of mini-browser-type thing, but before I go
> down that road I wanted to explore some simpler solutions.  The Commons ID
> thing is very nice, but I'm not so sure I'm comfortable putting in
> something that isn't actually released yet.
> 
> That being said, what was on the site for it got me to thinking... I think
> if I do a combination of the sum of the MAC address digits + the current
> time + the hashCode of the IP address, that is probably as random as I
> need.  But, if you know something about InetAddress that would make this
> not work, I'm all ears :)
> 
> Of course, I'm not sure how to get the MAC address yet, but one problem at
> a time...
> 
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> 
> On Fri, March 18, 2005 12:14 pm, Dakota Jack said:
> > InetAddress might not get the answer for you, Frank.  I don't know
> > what your setup is, but you can go to any ip address service outside
> > your system and get a unique return address for your machines with a
> > mini-browser.
> >
> > Jack
> >
> >
> > On Fri, 18 Mar 2005 11:36:10 -0500 (EST), Frank W. Zammetti
> > <[EMAIL PROTECTED]> wrote:
> >> Yes, I think InetAddress just might do the trick.  Thank you Kris!
> >>
> >> --
> >> Frank W. Zammetti
> >> Founder and Chief Software Architect
> >> Omnytex Technologies
> >> http://www.omnytex.com
> >>
> >> On Fri, March 18, 2005 11:24 am, Kris Schneider said:
> >> > Will InetAddress.getLocalHost() work for you?
> >> > NetworkInterface.getNetworkInterfaces() might also be of interest. Or,
> >> you
> >> > might want to create yourself an instance of java.rmi.dgc.VMID...
> >> >
> >> > Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:
> >> >
> >> >> Oh boy, I got a good one!  It's only related to Struts in that the
> >> >> application in question is Struts-based, so I hope no one minds a
> >> >> semi-OT
> >> >> question...
> >> >>
> >> >> Here's the situation... An app I wrote has a daemon thread that is
> >> >> spawned
> >> >> at startup (from a Struts plugin) that does periodic background
> >> >> processing
> >> >> tasks.  This works great, never had a bit of trouble.
> >> >>
> >> >> Now though, the app is moving from a single server to a clusted
> >> >> environment.
> >> >>
> >> >> So, what's going to happen is that each server in the cluster will
> >> have
> >> >> its own instance of the thread running on it.  Not a huge problem
> >> except
> >> >> that I have to be sure only one instance of the thread (i.e., one
> >> server
> >> >> in the cluster) is executing concurrently.
> >> >>
> >> >> The easy solution is just a database table that is checked when the
> >> >> thread
> >> >> wakes up.  If there is no entry in it, then there is no other
> >> instance
> >> >> running, so it can write an entry to the table and go off and do its
> >> >> thing.
> >> >>
> >> >> I want to be extremely certain that no issues arise in terms of one
> >> >> instance of the thread reading from the database while another
> >> instance
> >> >> is
> >> >> writing, etc.  So, aside from transactional database calls and
> >> row-level
> >> >> locking, I want to do one more thing: I want the thread to sleep a
> >> >> random
> >> >> number of seconds (1-300) at startup.  This will ensure that, all the
> >> >> database locking and such aside, the threads should all be offset
> >> from
> >> >> one
> >> >> another in terms of when they run.
> >> >>
> >> >> So, I need a random number generated when the thread starts up.  As
> >> we
> >> >> all
> >> >> know though, random number generation on most computers that don't
> >> have
> >> >> something like a Brownian motion sensor attached stuck in a cup of
> >> >> boiling
> >> >> coffee can't generate truly random numbers.  So, in theory, what
> >> could
> >> >> happen is that if all the servers in the cluster come up at the same
> >> >> time,
> >> >> the threads could wind up running at the same time regardless of the
> >> >> random sleep at the start!  It might never happen in reality, small
> >> >> fluctuations would probably offset them anyway, but I want to be more
> >> >> certain than that.
> >> >>
> >> >> So now we're at the crux of the problem...
> >> >>
> >> >> I can't just seed the random number generator with the current time
> >> >> because it concievably might not be random enough.  So, I thought I
> >> >> could
> >> >> just tally up the octets of the server's IP address and add that to
> >> the
> >> >> current time.  Then the seed on each server should be different
> >> enough.
> >> >>
> >> >> But, there doesn't ap

Re: Interesting problem...

2005-03-18 Thread Frank W. Zammetti
Commons ID has been in the sandbox for a year already?  Ugh, someone get a
release out! :)

I think the solution I used is going to suffice nicely.  I mean, in a
cluster each machine still has a unique IP address anyway, so that in and
of itself would have been enough.  But, adding in the VMID and current
time makes it even MORE certain to be unique.  Plus, in reading the
Commons ID page, that's very similar to how it is generating the UUIDs
anyway.

Thanks again, I very much appreciate the insight Martin!

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Fri, March 18, 2005 12:53 pm, Martin Wegner said:
> Frank,
>
> I was a little hinky myself about using Common ID in production.  But I've
> been using it or over a year and it has performed admirably.  We haven't
> seen any problems with the package.
>
> As for getting the MAC address I had to solve that problem about six
> months ago.  I had to resort to Runtime.getRuntime().exec() (yuck).  Here
> is where the madness all started:
>
>http://forum.java.sun.com/thread.jsp?forum=4&thread=245711
>
> It is ugly but it does indeed work.  Until you run on a box that is not
> using English.  And then you have the fun of boxes that have VPN software
> installed.  And you have to watch out for disconnected media.  Etc.  Etc.
> Etc.
>
> Anyway, I got it work and now I pluck the MAC address from the local box.
> It is ugly but I had to do it.
>
> If anyone has a better way of getting the MAC address I would like to
> know.
>
>
> --Marty
>
> --- "Frank W. Zammetti" <[EMAIL PROTECTED]> wrote:
>
>> Why do you think it wouldn't work?  Does it sometimes return incorrect
>> information in some setups?
>>
>> I thought of doing some kind of mini-browser-type thing, but before I go
>> down that road I wanted to explore some simpler solutions.  The Commons
>> ID
>> thing is very nice, but I'm not so sure I'm comfortable putting in
>> something that isn't actually released yet.
>>
>> That being said, what was on the site for it got me to thinking... I
>> think
>> if I do a combination of the sum of the MAC address digits + the current
>> time + the hashCode of the IP address, that is probably as random as I
>> need.  But, if you know something about InetAddress that would make this
>> not work, I'm all ears :)
>>
>> Of course, I'm not sure how to get the MAC address yet, but one problem
>> at
>> a time...
>>
>> --
>> Frank W. Zammetti
>> Founder and Chief Software Architect
>> Omnytex Technologies
>> http://www.omnytex.com
>>
>> On Fri, March 18, 2005 12:14 pm, Dakota Jack said:
>> > InetAddress might not get the answer for you, Frank.  I don't know
>> > what your setup is, but you can go to any ip address service outside
>> > your system and get a unique return address for your machines with a
>> > mini-browser.
>> >
>> > Jack
>> >
>> >
>> > On Fri, 18 Mar 2005 11:36:10 -0500 (EST), Frank W. Zammetti
>> > <[EMAIL PROTECTED]> wrote:
>> >> Yes, I think InetAddress just might do the trick.  Thank you Kris!
>> >>
>> >> --
>> >> Frank W. Zammetti
>> >> Founder and Chief Software Architect
>> >> Omnytex Technologies
>> >> http://www.omnytex.com
>> >>
>> >> On Fri, March 18, 2005 11:24 am, Kris Schneider said:
>> >> > Will InetAddress.getLocalHost() work for you?
>> >> > NetworkInterface.getNetworkInterfaces() might also be of interest.
>> Or,
>> >> you
>> >> > might want to create yourself an instance of java.rmi.dgc.VMID...
>> >> >
>> >> > Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:
>> >> >
>> >> >> Oh boy, I got a good one!  It's only related to Struts in that the
>> >> >> application in question is Struts-based, so I hope no one minds a
>> >> >> semi-OT
>> >> >> question...
>> >> >>
>> >> >> Here's the situation... An app I wrote has a daemon thread that is
>> >> >> spawned
>> >> >> at startup (from a Struts plugin) that does periodic background
>> >> >> processing
>> >> >> tasks.  This works great, never had a bit of trouble.
>> >> >>
>> >> >> Now though, the app is moving from a single server to a clusted
>> >> >> environment.
>> >> >>
>> >> >> So, what's going to happen is that each server in the cluster will
>> >> have
>> >> >> its own instance of the thread running on it.  Not a huge problem
>> >> except
>> >> >> that I have to be sure only one instance of the thread (i.e., one
>> >> server
>> >> >> in the cluster) is executing concurrently.
>> >> >>
>> >> >> The easy solution is just a database table that is checked when
>> the
>> >> >> thread
>> >> >> wakes up.  If there is no entry in it, then there is no other
>> >> instance
>> >> >> running, so it can write an entry to the table and go off and do
>> its
>> >> >> thing.
>> >> >>
>> >> >> I want to be extremely certain that no issues arise in terms of
>> one
>> >> >> instance of the thread reading from the database while another
>> >> instance
>> >> >> is
>> >> >> writing, etc.  So, aside from transactional database calls and
>> >> row-level
>> >> >> lock

Re: Interesting problem...

2005-03-18 Thread Martin Wegner
Frank,

I was a little hinky myself about using Common ID in production.  But I've
been using it or over a year and it has performed admirably.  We haven't
seen any problems with the package.

As for getting the MAC address I had to solve that problem about six
months ago.  I had to resort to Runtime.getRuntime().exec() (yuck).  Here
is where the madness all started:

   http://forum.java.sun.com/thread.jsp?forum=4&thread=245711

It is ugly but it does indeed work.  Until you run on a box that is not
using English.  And then you have the fun of boxes that have VPN software
installed.  And you have to watch out for disconnected media.  Etc.  Etc. 
Etc.

Anyway, I got it work and now I pluck the MAC address from the local box. 
It is ugly but I had to do it.

If anyone has a better way of getting the MAC address I would like to
know.


--Marty

--- "Frank W. Zammetti" <[EMAIL PROTECTED]> wrote:

> Why do you think it wouldn't work?  Does it sometimes return incorrect
> information in some setups?
> 
> I thought of doing some kind of mini-browser-type thing, but before I go
> down that road I wanted to explore some simpler solutions.  The Commons
> ID
> thing is very nice, but I'm not so sure I'm comfortable putting in
> something that isn't actually released yet.
> 
> That being said, what was on the site for it got me to thinking... I
> think
> if I do a combination of the sum of the MAC address digits + the current
> time + the hashCode of the IP address, that is probably as random as I
> need.  But, if you know something about InetAddress that would make this
> not work, I'm all ears :)
> 
> Of course, I'm not sure how to get the MAC address yet, but one problem
> at
> a time...
> 
> -- 
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> 
> On Fri, March 18, 2005 12:14 pm, Dakota Jack said:
> > InetAddress might not get the answer for you, Frank.  I don't know
> > what your setup is, but you can go to any ip address service outside
> > your system and get a unique return address for your machines with a
> > mini-browser.
> >
> > Jack
> >
> >
> > On Fri, 18 Mar 2005 11:36:10 -0500 (EST), Frank W. Zammetti
> > <[EMAIL PROTECTED]> wrote:
> >> Yes, I think InetAddress just might do the trick.  Thank you Kris!
> >>
> >> --
> >> Frank W. Zammetti
> >> Founder and Chief Software Architect
> >> Omnytex Technologies
> >> http://www.omnytex.com
> >>
> >> On Fri, March 18, 2005 11:24 am, Kris Schneider said:
> >> > Will InetAddress.getLocalHost() work for you?
> >> > NetworkInterface.getNetworkInterfaces() might also be of interest.
> Or,
> >> you
> >> > might want to create yourself an instance of java.rmi.dgc.VMID...
> >> >
> >> > Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:
> >> >
> >> >> Oh boy, I got a good one!  It's only related to Struts in that the
> >> >> application in question is Struts-based, so I hope no one minds a
> >> >> semi-OT
> >> >> question...
> >> >>
> >> >> Here's the situation... An app I wrote has a daemon thread that is
> >> >> spawned
> >> >> at startup (from a Struts plugin) that does periodic background
> >> >> processing
> >> >> tasks.  This works great, never had a bit of trouble.
> >> >>
> >> >> Now though, the app is moving from a single server to a clusted
> >> >> environment.
> >> >>
> >> >> So, what's going to happen is that each server in the cluster will
> >> have
> >> >> its own instance of the thread running on it.  Not a huge problem
> >> except
> >> >> that I have to be sure only one instance of the thread (i.e., one
> >> server
> >> >> in the cluster) is executing concurrently.
> >> >>
> >> >> The easy solution is just a database table that is checked when
> the
> >> >> thread
> >> >> wakes up.  If there is no entry in it, then there is no other
> >> instance
> >> >> running, so it can write an entry to the table and go off and do
> its
> >> >> thing.
> >> >>
> >> >> I want to be extremely certain that no issues arise in terms of
> one
> >> >> instance of the thread reading from the database while another
> >> instance
> >> >> is
> >> >> writing, etc.  So, aside from transactional database calls and
> >> row-level
> >> >> locking, I want to do one more thing: I want the thread to sleep a
> >> >> random
> >> >> number of seconds (1-300) at startup.  This will ensure that, all
> the
> >> >> database locking and such aside, the threads should all be offset
> >> from
> >> >> one
> >> >> another in terms of when they run.
> >> >>
> >> >> So, I need a random number generated when the thread starts up. 
> As
> >> we
> >> >> all
> >> >> know though, random number generation on most computers that don't
> >> have
> >> >> something like a Brownian motion sensor attached stuck in a cup of
> >> >> boiling
> >> >> coffee can't generate truly random numbers.  So, in theory, what
> >> could
> >> >> happen is that if all the servers in the cluster come up at the
> same
> >> >> time,
> >> >> the threads could wind up running at 

Re: Interesting problem...

2005-03-18 Thread Frank W. Zammetti
In the interest of giving back, here's what I wound up doing:

import java.net.InetAddress;
import java.rmi.dgc.VMID;
import java.util.GregorianCalendar;
int vmidHash = new VMID().hashCode();
long currentTime = new GregorianCalendar().getTimeInMillis();
int ipHash = InetAddress.getLocalHost().hashCode();
long seed = vmidHash + currentTime + ipHash;
Random randomGenerator = new Random(seed);
int seconds = randomGenerator.nextInt(200) + 100;

It's a combination of the VMID (which is supposed ot be unique for each
VM, but in actuality even on the SAME machine I'm getting a different
value each time, which is better for my use case) plus the current time
plus the machine's IP address.  Even on the same machine this is
generating unique values for each of three threads I am spawning (I've
done it about 30 times now and have never seen a duplicate value).  Does
the trick, I am happy.  Thanks for all the insight everyone!

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Fri, March 18, 2005 12:14 pm, Dakota Jack said:
> InetAddress might not get the answer for you, Frank.  I don't know
> what your setup is, but you can go to any ip address service outside
> your system and get a unique return address for your machines with a
> mini-browser.
>
> Jack
>
>
> On Fri, 18 Mar 2005 11:36:10 -0500 (EST), Frank W. Zammetti
> <[EMAIL PROTECTED]> wrote:
>> Yes, I think InetAddress just might do the trick.  Thank you Kris!
>>
>> --
>> Frank W. Zammetti
>> Founder and Chief Software Architect
>> Omnytex Technologies
>> http://www.omnytex.com
>>
>> On Fri, March 18, 2005 11:24 am, Kris Schneider said:
>> > Will InetAddress.getLocalHost() work for you?
>> > NetworkInterface.getNetworkInterfaces() might also be of interest. Or,
>> you
>> > might want to create yourself an instance of java.rmi.dgc.VMID...
>> >
>> > Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:
>> >
>> >> Oh boy, I got a good one!  It's only related to Struts in that the
>> >> application in question is Struts-based, so I hope no one minds a
>> >> semi-OT
>> >> question...
>> >>
>> >> Here's the situation... An app I wrote has a daemon thread that is
>> >> spawned
>> >> at startup (from a Struts plugin) that does periodic background
>> >> processing
>> >> tasks.  This works great, never had a bit of trouble.
>> >>
>> >> Now though, the app is moving from a single server to a clusted
>> >> environment.
>> >>
>> >> So, what's going to happen is that each server in the cluster will
>> have
>> >> its own instance of the thread running on it.  Not a huge problem
>> except
>> >> that I have to be sure only one instance of the thread (i.e., one
>> server
>> >> in the cluster) is executing concurrently.
>> >>
>> >> The easy solution is just a database table that is checked when the
>> >> thread
>> >> wakes up.  If there is no entry in it, then there is no other
>> instance
>> >> running, so it can write an entry to the table and go off and do its
>> >> thing.
>> >>
>> >> I want to be extremely certain that no issues arise in terms of one
>> >> instance of the thread reading from the database while another
>> instance
>> >> is
>> >> writing, etc.  So, aside from transactional database calls and
>> row-level
>> >> locking, I want to do one more thing: I want the thread to sleep a
>> >> random
>> >> number of seconds (1-300) at startup.  This will ensure that, all the
>> >> database locking and such aside, the threads should all be offset
>> from
>> >> one
>> >> another in terms of when they run.
>> >>
>> >> So, I need a random number generated when the thread starts up.  As
>> we
>> >> all
>> >> know though, random number generation on most computers that don't
>> have
>> >> something like a Brownian motion sensor attached stuck in a cup of
>> >> boiling
>> >> coffee can't generate truly random numbers.  So, in theory, what
>> could
>> >> happen is that if all the servers in the cluster come up at the same
>> >> time,
>> >> the threads could wind up running at the same time regardless of the
>> >> random sleep at the start!  It might never happen in reality, small
>> >> fluctuations would probably offset them anyway, but I want to be more
>> >> certain than that.
>> >>
>> >> So now we're at the crux of the problem...
>> >>
>> >> I can't just seed the random number generator with the current time
>> >> because it concievably might not be random enough.  So, I thought I
>> >> could
>> >> just tally up the octets of the server's IP address and add that to
>> the
>> >> current time.  Then the seed on each server should be different
>> enough.
>> >>
>> >> But, there doesn't appear to be any way to get the server IP address
>> >> independant of a request, so I can't get at it in my plugin.  Anyone
>> >> know
>> >> differently?
>> >>
>> >> Assuming that is the case, can anyone think of any other way to seed
>> the
>> >> generator that would ensure a different value on different machines
>> in
>> >> the
>> >> cluster?  Th

Re: Interesting problem...

2005-03-18 Thread Frank W. Zammetti
Why do you think it wouldn't work?  Does it sometimes return incorrect
information in some setups?

I thought of doing some kind of mini-browser-type thing, but before I go
down that road I wanted to explore some simpler solutions.  The Commons ID
thing is very nice, but I'm not so sure I'm comfortable putting in
something that isn't actually released yet.

That being said, what was on the site for it got me to thinking... I think
if I do a combination of the sum of the MAC address digits + the current
time + the hashCode of the IP address, that is probably as random as I
need.  But, if you know something about InetAddress that would make this
not work, I'm all ears :)

Of course, I'm not sure how to get the MAC address yet, but one problem at
a time...

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Fri, March 18, 2005 12:14 pm, Dakota Jack said:
> InetAddress might not get the answer for you, Frank.  I don't know
> what your setup is, but you can go to any ip address service outside
> your system and get a unique return address for your machines with a
> mini-browser.
>
> Jack
>
>
> On Fri, 18 Mar 2005 11:36:10 -0500 (EST), Frank W. Zammetti
> <[EMAIL PROTECTED]> wrote:
>> Yes, I think InetAddress just might do the trick.  Thank you Kris!
>>
>> --
>> Frank W. Zammetti
>> Founder and Chief Software Architect
>> Omnytex Technologies
>> http://www.omnytex.com
>>
>> On Fri, March 18, 2005 11:24 am, Kris Schneider said:
>> > Will InetAddress.getLocalHost() work for you?
>> > NetworkInterface.getNetworkInterfaces() might also be of interest. Or,
>> you
>> > might want to create yourself an instance of java.rmi.dgc.VMID...
>> >
>> > Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:
>> >
>> >> Oh boy, I got a good one!  It's only related to Struts in that the
>> >> application in question is Struts-based, so I hope no one minds a
>> >> semi-OT
>> >> question...
>> >>
>> >> Here's the situation... An app I wrote has a daemon thread that is
>> >> spawned
>> >> at startup (from a Struts plugin) that does periodic background
>> >> processing
>> >> tasks.  This works great, never had a bit of trouble.
>> >>
>> >> Now though, the app is moving from a single server to a clusted
>> >> environment.
>> >>
>> >> So, what's going to happen is that each server in the cluster will
>> have
>> >> its own instance of the thread running on it.  Not a huge problem
>> except
>> >> that I have to be sure only one instance of the thread (i.e., one
>> server
>> >> in the cluster) is executing concurrently.
>> >>
>> >> The easy solution is just a database table that is checked when the
>> >> thread
>> >> wakes up.  If there is no entry in it, then there is no other
>> instance
>> >> running, so it can write an entry to the table and go off and do its
>> >> thing.
>> >>
>> >> I want to be extremely certain that no issues arise in terms of one
>> >> instance of the thread reading from the database while another
>> instance
>> >> is
>> >> writing, etc.  So, aside from transactional database calls and
>> row-level
>> >> locking, I want to do one more thing: I want the thread to sleep a
>> >> random
>> >> number of seconds (1-300) at startup.  This will ensure that, all the
>> >> database locking and such aside, the threads should all be offset
>> from
>> >> one
>> >> another in terms of when they run.
>> >>
>> >> So, I need a random number generated when the thread starts up.  As
>> we
>> >> all
>> >> know though, random number generation on most computers that don't
>> have
>> >> something like a Brownian motion sensor attached stuck in a cup of
>> >> boiling
>> >> coffee can't generate truly random numbers.  So, in theory, what
>> could
>> >> happen is that if all the servers in the cluster come up at the same
>> >> time,
>> >> the threads could wind up running at the same time regardless of the
>> >> random sleep at the start!  It might never happen in reality, small
>> >> fluctuations would probably offset them anyway, but I want to be more
>> >> certain than that.
>> >>
>> >> So now we're at the crux of the problem...
>> >>
>> >> I can't just seed the random number generator with the current time
>> >> because it concievably might not be random enough.  So, I thought I
>> >> could
>> >> just tally up the octets of the server's IP address and add that to
>> the
>> >> current time.  Then the seed on each server should be different
>> enough.
>> >>
>> >> But, there doesn't appear to be any way to get the server IP address
>> >> independant of a request, so I can't get at it in my plugin.  Anyone
>> >> know
>> >> differently?
>> >>
>> >> Assuming that is the case, can anyone think of any other way to seed
>> the
>> >> generator that would ensure a different value on different machines
>> in
>> >> the
>> >> cluster?  There are some options like encoding the individual server
>> >> names
>> >> in my app's config file with a different seed value for each, but
>> that
>> >> makes main

Re: Interesting problem...

2005-03-18 Thread Dakota Jack
InetAddress might not get the answer for you, Frank.  I don't know
what your setup is, but you can go to any ip address service outside
your system and get a unique return address for your machines with a
mini-browser.

Jack


On Fri, 18 Mar 2005 11:36:10 -0500 (EST), Frank W. Zammetti
<[EMAIL PROTECTED]> wrote:
> Yes, I think InetAddress just might do the trick.  Thank you Kris!
> 
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> 
> On Fri, March 18, 2005 11:24 am, Kris Schneider said:
> > Will InetAddress.getLocalHost() work for you?
> > NetworkInterface.getNetworkInterfaces() might also be of interest. Or, you
> > might want to create yourself an instance of java.rmi.dgc.VMID...
> >
> > Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:
> >
> >> Oh boy, I got a good one!  It's only related to Struts in that the
> >> application in question is Struts-based, so I hope no one minds a
> >> semi-OT
> >> question...
> >>
> >> Here's the situation... An app I wrote has a daemon thread that is
> >> spawned
> >> at startup (from a Struts plugin) that does periodic background
> >> processing
> >> tasks.  This works great, never had a bit of trouble.
> >>
> >> Now though, the app is moving from a single server to a clusted
> >> environment.
> >>
> >> So, what's going to happen is that each server in the cluster will have
> >> its own instance of the thread running on it.  Not a huge problem except
> >> that I have to be sure only one instance of the thread (i.e., one server
> >> in the cluster) is executing concurrently.
> >>
> >> The easy solution is just a database table that is checked when the
> >> thread
> >> wakes up.  If there is no entry in it, then there is no other instance
> >> running, so it can write an entry to the table and go off and do its
> >> thing.
> >>
> >> I want to be extremely certain that no issues arise in terms of one
> >> instance of the thread reading from the database while another instance
> >> is
> >> writing, etc.  So, aside from transactional database calls and row-level
> >> locking, I want to do one more thing: I want the thread to sleep a
> >> random
> >> number of seconds (1-300) at startup.  This will ensure that, all the
> >> database locking and such aside, the threads should all be offset from
> >> one
> >> another in terms of when they run.
> >>
> >> So, I need a random number generated when the thread starts up.  As we
> >> all
> >> know though, random number generation on most computers that don't have
> >> something like a Brownian motion sensor attached stuck in a cup of
> >> boiling
> >> coffee can't generate truly random numbers.  So, in theory, what could
> >> happen is that if all the servers in the cluster come up at the same
> >> time,
> >> the threads could wind up running at the same time regardless of the
> >> random sleep at the start!  It might never happen in reality, small
> >> fluctuations would probably offset them anyway, but I want to be more
> >> certain than that.
> >>
> >> So now we're at the crux of the problem...
> >>
> >> I can't just seed the random number generator with the current time
> >> because it concievably might not be random enough.  So, I thought I
> >> could
> >> just tally up the octets of the server's IP address and add that to the
> >> current time.  Then the seed on each server should be different enough.
> >>
> >> But, there doesn't appear to be any way to get the server IP address
> >> independant of a request, so I can't get at it in my plugin.  Anyone
> >> know
> >> differently?
> >>
> >> Assuming that is the case, can anyone think of any other way to seed the
> >> generator that would ensure a different value on different machines in
> >> the
> >> cluster?  There are some options like encoding the individual server
> >> names
> >> in my app's config file with a different seed value for each, but that
> >> makes maintenance a pain if a new server is added or one removed or
> >> addresses simply changed.
> >>
> >> Any ideas?  Thanks!
> >>
> >> --
> >> Frank W. Zammetti
> >> Founder and Chief Software Architect
> >> Omnytex Technologies
> >> http://www.omnytex.com
> >
> > --
> > Kris Schneider 
> > D.O.Tech   
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Interesting problem...

2005-03-18 Thread Frank W. Zammetti
Oh, that is sweet!  I was totally unaware of that.  Thanks Martin!

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Fri, March 18, 2005 11:52 am, Martin Wegner said:
>
> You can also use the Jakarta Commons ID packageto generate a GUID which is
> guaranteed to be unique in the universe.  You could then convert the GUID
> to your seed.
>
>
>
> --- Kris Schneider <[EMAIL PROTECTED]> wrote:
>> Will InetAddress.getLocalHost() work for you?
>> NetworkInterface.getNetworkInterfaces() might also be of interest. Or,
>> you
>> might want to create yourself an instance of java.rmi.dgc.VMID...
>>
>> Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:
>>
>> > Oh boy, I got a good one!  It's only related to Struts in that the
>> > application in question is Struts-based, so I hope no one minds a
>> semi-OT
>> > question...
>> >
>> > Here's the situation... An app I wrote has a daemon thread that is
>> spawned
>> > at startup (from a Struts plugin) that does periodic background
>> processing
>> > tasks.  This works great, never had a bit of trouble.
>> >
>> > Now though, the app is moving from a single server to a clusted
>> environment.
>> >
>> > So, what's going to happen is that each server in the cluster will
>> have
>> > its own instance of the thread running on it.  Not a huge problem
>> except
>> > that I have to be sure only one instance of the thread (i.e., one
>> server
>> > in the cluster) is executing concurrently.
>> >
>> > The easy solution is just a database table that is checked when the
>> thread
>> > wakes up.  If there is no entry in it, then there is no other instance
>> > running, so it can write an entry to the table and go off and do its
>> > thing.
>> >
>> > I want to be extremely certain that no issues arise in terms of one
>> > instance of the thread reading from the database while another
>> instance is
>> > writing, etc.  So, aside from transactional database calls and
>> row-level
>> > locking, I want to do one more thing: I want the thread to sleep a
>> random
>> > number of seconds (1-300) at startup.  This will ensure that, all the
>> > database locking and such aside, the threads should all be offset from
>> one
>> > another in terms of when they run.
>> >
>> > So, I need a random number generated when the thread starts up.  As we
>> all
>> > know though, random number generation on most computers that don't
>> have
>> > something like a Brownian motion sensor attached stuck in a cup of
>> boiling
>> > coffee can't generate truly random numbers.  So, in theory, what could
>> > happen is that if all the servers in the cluster come up at the same
>> time,
>> > the threads could wind up running at the same time regardless of the
>> > random sleep at the start!  It might never happen in reality, small
>> > fluctuations would probably offset them anyway, but I want to be more
>> > certain than that.
>> >
>> > So now we're at the crux of the problem...
>> >
>> > I can't just seed the random number generator with the current time
>> > because it concievably might not be random enough.  So, I thought I
>> could
>> > just tally up the octets of the server's IP address and add that to
>> the
>> > current time.  Then the seed on each server should be different
>> enough.
>> >
>> > But, there doesn't appear to be any way to get the server IP address
>> > independant of a request, so I can't get at it in my plugin.  Anyone
>> know
>> > differently?
>> >
>> > Assuming that is the case, can anyone think of any other way to seed
>> the
>> > generator that would ensure a different value on different machines in
>> the
>> > cluster?  There are some options like encoding the individual server
>> names
>> > in my app's config file with a different seed value for each, but that
>> > makes maintenance a pain if a new server is added or one removed or
>> > addresses simply changed.
>> >
>> > Any ideas?  Thanks!
>> >
>> > --
>> > Frank W. Zammetti
>> > Founder and Chief Software Architect
>> > Omnytex Technologies
>> > http://www.omnytex.com
>>
>> --
>> Kris Schneider 
>> D.O.Tech   
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Interesting problem...

2005-03-18 Thread Martin Wegner

You can also use the Jakarta Commons ID packageto generate a GUID which is
guaranteed to be unique in the universe.  You could then convert the GUID
to your seed.



--- Kris Schneider <[EMAIL PROTECTED]> wrote:
> Will InetAddress.getLocalHost() work for you?
> NetworkInterface.getNetworkInterfaces() might also be of interest. Or,
> you
> might want to create yourself an instance of java.rmi.dgc.VMID...
> 
> Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:
> 
> > Oh boy, I got a good one!  It's only related to Struts in that the
> > application in question is Struts-based, so I hope no one minds a
> semi-OT
> > question...
> > 
> > Here's the situation... An app I wrote has a daemon thread that is
> spawned
> > at startup (from a Struts plugin) that does periodic background
> processing
> > tasks.  This works great, never had a bit of trouble.
> > 
> > Now though, the app is moving from a single server to a clusted
> environment.
> > 
> > So, what's going to happen is that each server in the cluster will
> have
> > its own instance of the thread running on it.  Not a huge problem
> except
> > that I have to be sure only one instance of the thread (i.e., one
> server
> > in the cluster) is executing concurrently.
> > 
> > The easy solution is just a database table that is checked when the
> thread
> > wakes up.  If there is no entry in it, then there is no other instance
> > running, so it can write an entry to the table and go off and do its
> > thing.
> > 
> > I want to be extremely certain that no issues arise in terms of one
> > instance of the thread reading from the database while another
> instance is
> > writing, etc.  So, aside from transactional database calls and
> row-level
> > locking, I want to do one more thing: I want the thread to sleep a
> random
> > number of seconds (1-300) at startup.  This will ensure that, all the
> > database locking and such aside, the threads should all be offset from
> one
> > another in terms of when they run.
> > 
> > So, I need a random number generated when the thread starts up.  As we
> all
> > know though, random number generation on most computers that don't
> have
> > something like a Brownian motion sensor attached stuck in a cup of
> boiling
> > coffee can't generate truly random numbers.  So, in theory, what could
> > happen is that if all the servers in the cluster come up at the same
> time,
> > the threads could wind up running at the same time regardless of the
> > random sleep at the start!  It might never happen in reality, small
> > fluctuations would probably offset them anyway, but I want to be more
> > certain than that.
> > 
> > So now we're at the crux of the problem...
> > 
> > I can't just seed the random number generator with the current time
> > because it concievably might not be random enough.  So, I thought I
> could
> > just tally up the octets of the server's IP address and add that to
> the
> > current time.  Then the seed on each server should be different
> enough.
> > 
> > But, there doesn't appear to be any way to get the server IP address
> > independant of a request, so I can't get at it in my plugin.  Anyone
> know
> > differently?
> > 
> > Assuming that is the case, can anyone think of any other way to seed
> the
> > generator that would ensure a different value on different machines in
> the
> > cluster?  There are some options like encoding the individual server
> names
> > in my app's config file with a different seed value for each, but that
> > makes maintenance a pain if a new server is added or one removed or
> > addresses simply changed.
> > 
> > Any ideas?  Thanks!
> > 
> > -- 
> > Frank W. Zammetti
> > Founder and Chief Software Architect
> > Omnytex Technologies
> > http://www.omnytex.com
> 
> -- 
> Kris Schneider 
> D.O.Tech   
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Interesting problem...

2005-03-18 Thread Frank W. Zammetti
Yes, I think InetAddress just might do the trick.  Thank you Kris!

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Fri, March 18, 2005 11:24 am, Kris Schneider said:
> Will InetAddress.getLocalHost() work for you?
> NetworkInterface.getNetworkInterfaces() might also be of interest. Or, you
> might want to create yourself an instance of java.rmi.dgc.VMID...
>
> Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:
>
>> Oh boy, I got a good one!  It's only related to Struts in that the
>> application in question is Struts-based, so I hope no one minds a
>> semi-OT
>> question...
>>
>> Here's the situation... An app I wrote has a daemon thread that is
>> spawned
>> at startup (from a Struts plugin) that does periodic background
>> processing
>> tasks.  This works great, never had a bit of trouble.
>>
>> Now though, the app is moving from a single server to a clusted
>> environment.
>>
>> So, what's going to happen is that each server in the cluster will have
>> its own instance of the thread running on it.  Not a huge problem except
>> that I have to be sure only one instance of the thread (i.e., one server
>> in the cluster) is executing concurrently.
>>
>> The easy solution is just a database table that is checked when the
>> thread
>> wakes up.  If there is no entry in it, then there is no other instance
>> running, so it can write an entry to the table and go off and do its
>> thing.
>>
>> I want to be extremely certain that no issues arise in terms of one
>> instance of the thread reading from the database while another instance
>> is
>> writing, etc.  So, aside from transactional database calls and row-level
>> locking, I want to do one more thing: I want the thread to sleep a
>> random
>> number of seconds (1-300) at startup.  This will ensure that, all the
>> database locking and such aside, the threads should all be offset from
>> one
>> another in terms of when they run.
>>
>> So, I need a random number generated when the thread starts up.  As we
>> all
>> know though, random number generation on most computers that don't have
>> something like a Brownian motion sensor attached stuck in a cup of
>> boiling
>> coffee can't generate truly random numbers.  So, in theory, what could
>> happen is that if all the servers in the cluster come up at the same
>> time,
>> the threads could wind up running at the same time regardless of the
>> random sleep at the start!  It might never happen in reality, small
>> fluctuations would probably offset them anyway, but I want to be more
>> certain than that.
>>
>> So now we're at the crux of the problem...
>>
>> I can't just seed the random number generator with the current time
>> because it concievably might not be random enough.  So, I thought I
>> could
>> just tally up the octets of the server's IP address and add that to the
>> current time.  Then the seed on each server should be different enough.
>>
>> But, there doesn't appear to be any way to get the server IP address
>> independant of a request, so I can't get at it in my plugin.  Anyone
>> know
>> differently?
>>
>> Assuming that is the case, can anyone think of any other way to seed the
>> generator that would ensure a different value on different machines in
>> the
>> cluster?  There are some options like encoding the individual server
>> names
>> in my app's config file with a different seed value for each, but that
>> makes maintenance a pain if a new server is added or one removed or
>> addresses simply changed.
>>
>> Any ideas?  Thanks!
>>
>> --
>> Frank W. Zammetti
>> Founder and Chief Software Architect
>> Omnytex Technologies
>> http://www.omnytex.com
>
> --
> Kris Schneider 
> D.O.Tech   
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Interesting problem...

2005-03-18 Thread Kris Schneider
Will InetAddress.getLocalHost() work for you?
NetworkInterface.getNetworkInterfaces() might also be of interest. Or, you
might want to create yourself an instance of java.rmi.dgc.VMID...

Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:

> Oh boy, I got a good one!  It's only related to Struts in that the
> application in question is Struts-based, so I hope no one minds a semi-OT
> question...
> 
> Here's the situation... An app I wrote has a daemon thread that is spawned
> at startup (from a Struts plugin) that does periodic background processing
> tasks.  This works great, never had a bit of trouble.
> 
> Now though, the app is moving from a single server to a clusted environment.
> 
> So, what's going to happen is that each server in the cluster will have
> its own instance of the thread running on it.  Not a huge problem except
> that I have to be sure only one instance of the thread (i.e., one server
> in the cluster) is executing concurrently.
> 
> The easy solution is just a database table that is checked when the thread
> wakes up.  If there is no entry in it, then there is no other instance
> running, so it can write an entry to the table and go off and do its
> thing.
> 
> I want to be extremely certain that no issues arise in terms of one
> instance of the thread reading from the database while another instance is
> writing, etc.  So, aside from transactional database calls and row-level
> locking, I want to do one more thing: I want the thread to sleep a random
> number of seconds (1-300) at startup.  This will ensure that, all the
> database locking and such aside, the threads should all be offset from one
> another in terms of when they run.
> 
> So, I need a random number generated when the thread starts up.  As we all
> know though, random number generation on most computers that don't have
> something like a Brownian motion sensor attached stuck in a cup of boiling
> coffee can't generate truly random numbers.  So, in theory, what could
> happen is that if all the servers in the cluster come up at the same time,
> the threads could wind up running at the same time regardless of the
> random sleep at the start!  It might never happen in reality, small
> fluctuations would probably offset them anyway, but I want to be more
> certain than that.
> 
> So now we're at the crux of the problem...
> 
> I can't just seed the random number generator with the current time
> because it concievably might not be random enough.  So, I thought I could
> just tally up the octets of the server's IP address and add that to the
> current time.  Then the seed on each server should be different enough.
> 
> But, there doesn't appear to be any way to get the server IP address
> independant of a request, so I can't get at it in my plugin.  Anyone know
> differently?
> 
> Assuming that is the case, can anyone think of any other way to seed the
> generator that would ensure a different value on different machines in the
> cluster?  There are some options like encoding the individual server names
> in my app's config file with a different seed value for each, but that
> makes maintenance a pain if a new server is added or one removed or
> addresses simply changed.
> 
> Any ideas?  Thanks!
> 
> -- 
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com

-- 
Kris Schneider 
D.O.Tech   

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Interesting problem...

2005-03-18 Thread Frank W. Zammetti
Oh boy, I got a good one!  It's only related to Struts in that the
application in question is Struts-based, so I hope no one minds a semi-OT
question...

Here's the situation... An app I wrote has a daemon thread that is spawned
at startup (from a Struts plugin) that does periodic background processing
tasks.  This works great, never had a bit of trouble.

Now though, the app is moving from a single server to a clusted environment.

So, what's going to happen is that each server in the cluster will have
its own instance of the thread running on it.  Not a huge problem except
that I have to be sure only one instance of the thread (i.e., one server
in the cluster) is executing concurrently.

The easy solution is just a database table that is checked when the thread
wakes up.  If there is no entry in it, then there is no other instance
running, so it can write an entry to the table and go off and do its
thing.

I want to be extremely certain that no issues arise in terms of one
instance of the thread reading from the database while another instance is
writing, etc.  So, aside from transactional database calls and row-level
locking, I want to do one more thing: I want the thread to sleep a random
number of seconds (1-300) at startup.  This will ensure that, all the
database locking and such aside, the threads should all be offset from one
another in terms of when they run.

So, I need a random number generated when the thread starts up.  As we all
know though, random number generation on most computers that don't have
something like a Brownian motion sensor attached stuck in a cup of boiling
coffee can't generate truly random numbers.  So, in theory, what could
happen is that if all the servers in the cluster come up at the same time,
the threads could wind up running at the same time regardless of the
random sleep at the start!  It might never happen in reality, small
fluctuations would probably offset them anyway, but I want to be more
certain than that.

So now we're at the crux of the problem...

I can't just seed the random number generator with the current time
because it concievably might not be random enough.  So, I thought I could
just tally up the octets of the server's IP address and add that to the
current time.  Then the seed on each server should be different enough.

But, there doesn't appear to be any way to get the server IP address
independant of a request, so I can't get at it in my plugin.  Anyone know
differently?

Assuming that is the case, can anyone think of any other way to seed the
generator that would ensure a different value on different machines in the
cluster?  There are some options like encoding the individual server names
in my app's config file with a different seed value for each, but that
makes maintenance a pain if a new server is added or one removed or
addresses simply changed.

Any ideas?  Thanks!

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Interesting tiles/redirect interaction problem

2004-08-27 Thread Jason Lea
From what I can see here it looks like the page is already being 
written out when the error occurs from what I can see.
You have gone to your first action, done some work, then return the 
mainLayout tile.  The tile then starts building the response based on 
layout2.jsp.  It includes the pages you have in the list.  
showBorrowerDemographics.do?detail=summary is calling an action and the 
result is included in the page.

When the error occurs, it redirects to the applicationFailure tile, and 
it is included in the mainLayout.

Perhaps you either need to change your applicationFailure tile so it 
returns a tile page instead of a complete web page.  Or have 
showPaymentHistory throw a different exception which gets caught and 
returns a tile.  If your main action failed it would want to throw the 
exception and have a whole page constructed and returned, but a tile 
should return a simple tile not a whole page.

Jim Barrows wrote:
I'm using tiles, and some of the tiles are summary pages.  For instance a payment summary, it just shows the date and the amount.  While the detail page shows how the payment was applied (how much to interest etc.)
So my tiles definition looks like:

   
   	
   	
   	
   	 
   
   
   		
   		
   		
   	
   	
   		
   	
   			
   		
   		 
   		 
   		  		
   	
   	
   		
   	
   

Okay, this works... now let's say /showPaymentHistory.do encounters something catastrophic, like DB down etc.  So, it throws a BusinessObjectException.  Cool.. that works
Now, I've never used the exception handling stuff in struts-config.xml so here's the definition:



And the handler says:
LogWrapper.logAlert( "Business Object Exception: " + ex.getMessage());
   ActionForward forward = mapping.findForward( "applicationFailure");
   return forward;
and the forward has redirect = true in the struts-config.xml
So. I would expect that even though the summary pagelet is throwing the exception, 
that it would forward to the applicationFailure tiles definition.  What I didn't 
expect was for the entire page to end up nested inside the original page being 
requested.
Shouldn't redirect=true do what I expect with regards to tiles?  and pop to a new 
tiles definition rather then include it?
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 


--
Jason Lea

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Interesting tiles/redirect interaction problem

2004-08-27 Thread Jim Barrows
I'm using tiles, and some of the tiles are summary pages.  For instance a payment 
summary, it just shows the date and the amount.  While the detail page shows how the 
payment was applied (how much to interest etc.)
So my tiles definition looks like:


 


 









  

 
 







Okay, this works... now let's say /showPaymentHistory.do encounters something 
catastrophic, like DB down etc.  So, it throws a BusinessObjectException.  Cool.. that 
works
Now, I've never used the exception handling stuff in struts-config.xml so here's 
the definition:



And the handler says:
LogWrapper.logAlert( "Business Object Exception: " + ex.getMessage());
ActionForward forward = mapping.findForward( "applicationFailure");
return forward;
and the forward has redirect = true in the struts-config.xml

So. I would expect that even though the summary pagelet is throwing the exception, 
that it would forward to the applicationFailure tiles definition.  What I didn't 
expect was for the entire page to end up nested inside the original page being 
requested.
Shouldn't redirect=true do what I expect with regards to tiles?  and pop to a new 
tiles definition rather then include it?

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]