| Author |
EAServer Service Component
|
|
| Dimitris Karistinos 2005-11-08, 4:15 pm |
| Hello group,
I want to create a service component and I want to define that it will start
working at 00:00 . I will not be in my office to restart EAServer in order
for the component to start working.
So is there another way if I deploy it sometime during the day, to start
working at 00:00?
Regards
Dimitris Karistinos
| |
| Peter Abbott 2005-11-08, 4:15 pm |
| From experience, you would be better off writing a message bean to do
the work. Service components can be very messy to write and wont have
access to a lot of the J2EE components it is treated effectively as
another client. It will also use up unnecessary resources each time it
runs to check the time.
With message beans you can program them to run at specified intervals.
Chapter 29 of the Programmers guide contains a section on developing
message service apps, near the bottom is a section how to create
scheduled messages
Pete
Dimitris Karistinos wrote:
> Hello group,
> I want to create a service component and I want to define that it will start
> working at 00:00 . I will not be in my office to restart EAServer in order
> for the component to start working.
>
> So is there another way if I deploy it sometime during the day, to start
> working at 00:00?
>
> Regards
> Dimitris Karistinos
>
>
| |
| Dean Jones 2005-11-08, 4:15 pm |
| Depending on how close you have to be to midnight you can create a service
component that starts a new thread using threadmanager. Have the thread run
every 'x' seconds. Example 5 minutes. Then have the thread check the time,
if there is no work to do the thread exits and wait to be triggered again in
5 minutes. Set the run parameter to a level that solves your problem.
--
Dean Jones [TeamSybase]
CEO
Certified PowerBuilder Developer
www.powerobjects.com
(612) 339-3355 ext 112
"Dimitris Karistinos" <dkaris@relational.gr> wrote in message
news:436f6ef6$1@foru
ms-1-dub...
> Hello group,
> I want to create a service component and I want to define that it will
> start working at 00:00 . I will not be in my office to restart EAServer
> in order for the component to start working.
>
> So is there another way if I deploy it sometime during the day, to start
> working at 00:00?
>
> Regards
> Dimitris Karistinos
>
| |
| Peter Abbott 2005-11-08, 4:15 pm |
| The only problem with that approach is that if you want to restart the
server manually within those 5 minutes it is "sleeping" you sometimes
have to wait for the 5 minutes to elapse before the server can actually
be restarted.
Pete
Dean Jones wrote:
> Depending on how close you have to be to midnight you can create a service
> component that starts a new thread using threadmanager. Have the thread run
> every 'x' seconds. Example 5 minutes. Then have the thread check the time,
> if there is no work to do the thread exits and wait to be triggered again in
> 5 minutes. Set the run parameter to a level that solves your problem.
>
| |
| Brad Ashton 2005-11-08, 8:25 pm |
| I've had service objects like this for years and never had to wait as you
state.
"Peter Abbott" <abmannz@yahoo.co.nz> wrote in message
news:437109bf$1@foru
ms-2-dub...[color=darkred]
> The only problem with that approach is that if you want to restart the
> server manually within those 5 minutes it is "sleeping" you sometimes have
> to wait for the 5 minutes to elapse before the server can actually be
> restarted.
>
> Pete
>
> Dean Jones wrote:
| |
| Daniel Coppersmith 2005-11-08, 8:25 pm |
| You mean SERVICE, right? If you are restarting your SERVER, it's not going
to be able run your component no matter how you code it until the server is
restarted.
If you mean having a way to manually run the component even if it's not
midnight, you can easily write a tool that will submit the same component
that the thread manager does but have it do it instantly.
Or you could reduce your 5 minutes to 5 seconds. It will increase CPU
usage, but probably not a noticable amount.
----- Original Message -----
From: "Peter Abbott" <abmannz@yahoo.co.nz>
Newsgroups: sybase.public.easerver.general
Sent: Tuesday, November 08, 2005 2:31 PM
Subject: Re: EAServer Service Component
[color=darkred]
> The only problem with that approach is that if you want to restart the
> server manually within those 5 minutes it is "sleeping" you sometimes
> have to wait for the 5 minutes to elapse before the server can actually
> be restarted.
>
> Pete
>
> Dean Jones wrote:
service[color=darkre
d]
run[color=darkred]
time,[color=darkred]
again in[color=darkred]
| |
| Peter Abbott 2005-11-08, 8:25 pm |
| I tried using a service component about a year ago and had no end of
problems. Using a scheduled message bean means that you have direct
access to J2EE resources directly.
Pete
Brad Ashton wrote:
> I've had service objects like this for years and never had to wait as you
> state.
>
> "Peter Abbott" <abmannz@yahoo.co.nz> wrote in message
> news:437109bf$1@foru
ms-2-dub...
>
>
>
>
| |
| Dean Jones 2005-11-09, 9:24 am |
| I don't understand your point. You can restart the server at any point. The
service component will start and start the monitor component through
threadmanage.
--
Dean Jones [TeamSybase]
CEO
Certified PowerBuilder Developer
www.powerobjects.com
(612) 339-3355 ext 112
"Peter Abbott" <abmannz@yahoo.co.nz> wrote in message
news:437109bf$1@foru
ms-2-dub...[color=darkred]
> The only problem with that approach is that if you want to restart the
> server manually within those 5 minutes it is "sleeping" you sometimes have
> to wait for the 5 minutes to elapse before the server can actually be
> restarted.
>
> Pete
>
> Dean Jones wrote:
| |
| Dean Jones 2005-11-09, 9:24 am |
| There is a big issue with PB components as service objects if they have a
sleep(). The idea is to have the service component start a new thread using
threadmanager, now you don't have to code a sleep.
--
Dean Jones [TeamSybase]
CEO
Certified PowerBuilder Developer
www.powerobjects.com
(612) 339-3355 ext 112
"Brad Ashton" <brad.ashton@gbrx.nospam.com> wrote in message
news:437123dc@forums
-2-dub...
> I've had service objects like this for years and never had to wait as you
> state.
>
> "Peter Abbott" <abmannz@yahoo.co.nz> wrote in message
> news:437109bf$1@foru
ms-2-dub...
>
>
| |
| Dean Jones 2005-11-09, 9:24 am |
| Agreed the run interval is determined by business rules.
--
Dean Jones [TeamSybase]
CEO
Certified PowerBuilder Developer
www.powerobjects.com
(612) 339-3355 ext 112
"Daniel Coppersmith" <daniel_N.0.S.P.A. M_at_InFrontSoftware
_D0T_C0M> wrote
in message news:43712711$1@foru
ms-2-dub...
> You mean SERVICE, right? If you are restarting your SERVER, it's not
> going
> to be able run your component no matter how you code it until the server
> is
> restarted.
>
> If you mean having a way to manually run the component even if it's not
> midnight, you can easily write a tool that will submit the same component
> that the thread manager does but have it do it instantly.
>
> Or you could reduce your 5 minutes to 5 seconds. It will increase CPU
> usage, but probably not a noticable amount.
>
>
> ----- Original Message -----
> From: "Peter Abbott" <abmannz@yahoo.co.nz>
> Newsgroups: sybase.public.easerver.general
> Sent: Tuesday, November 08, 2005 2:31 PM
> Subject: Re: EAServer Service Component
>
>
> service
> run
> time,
> again in
>
>
| |
| Peter Abbott 2005-11-09, 8:25 pm |
| ok, using the thread manager is different. I had just been using the
Thread.sleep() and this can cause the server to have wait to restart.
This is also mentioned in the developers guide if you use this approach,
but using the Thread Manager appears to be different.
Dean Jones wrote:
> I don't understand your point. You can restart the server at any point. The
> service component will start and start the monitor component through
> threadmanage.
>
| |
| Dean Jones 2005-11-09, 8:25 pm |
| much different. The component is not in a endless loop. The run method gets
called every 'x' seconds from the threadmanager.
--
Dean Jones [TeamSybase]
CEO
Certified PowerBuilder Developer
www.powerobjects.com
(612) 339-3355 ext 112
"Peter Abbott" <abmannz@yahoo.co.nz> wrote in message
news:43724a5d$1@foru
ms-2-dub...[color=darkred]
> ok, using the thread manager is different. I had just been using the
> Thread.sleep() and this can cause the server to have wait to restart. This
> is also mentioned in the developers guide if you use this approach, but
> using the Thread Manager appears to be different.
>
>
>
> Dean Jones wrote:
| |
| Gert Van der Straeten 2005-11-14, 3:24 am |
| You could calculate the remaining time from now (server
start) to 00:00 and use JagSleep (external function of
libjdispatch.dll) to suspend the thread.
For more info see
http://sybooks.sybase.com/onlineboo...br />
ew/21414;
pt=21461
Gert
> Hello group,
> I want to create a service component and I want to define
> that it will start working at 00:00 . I will not be in
> my office to restart EAServer in order for the component
> to start working.
>
> So is there another way if I deploy it sometime during the
> day, to start working at 00:00?
>
> Regards
> Dimitris Karistinos
>
>
|
|
|
|