How to shutdown a remoting Server (SAO-Singleton started with RemotingConfiguration.Configure())

J

José Joye

Hello,

What is the best way to stop a remoting server (Singleton SAO) that has been
started with RemotingConfiguration.Configure().
For sure, I want to do this without quitting the application :)

In fact, at a given time based on an internal event, I would like to stop
the remoting functionality within my process.

Many thanks,

- José
 
P

Peter Bradley

Others may know better, but I would say either to set the lifetime to a
suitable value, or use SingleCall objects (instead of Singletons) that die
as soon as any method on them is completed.

HTH


Peter
 
J

José Joye

Hello Peter,

Thanks,
However, I do not want to recycle my remoted object. I want to prevent any
client from using my remoting Server. I want to be able to shutdown the
fonctionality at a given time.

- José
 
P

Peter Bradley

Hi Jose
However, I do not want to recycle my remoted object

I don't know what you mean by "recycle". I hope it doesn't mean that you
are using your Singleton object as a stateful object (i.e. to use state it
retains between calls). This would be a very bad idea. If you want to
retain state, you should use CAOs. Using SingeCall SAOs is more scalable
anyway - and more in tune with the move to a Service Oriented Architecture
(IMHO and from what I've read).
I want to prevent any client from using my remoting Server.

Do you mean that you want to stop the server? Or are you trying to
distinguish between clients? If the former, just stop the service on the
remote server. If the latter, couldn't you use your security credentials
info?
I want to be able to shutdown the fonctionality at a given time.

For everyone? Shut down the service on the server.

We always use configuration files for remoting, as well. It means that you
can make lots of changes on the fly just be changing a setting or two in the
config file.

HTH


Peter
 
J

José Joye

Hello Peter,

Thanks for your feedback.

Regarding the first part of your answer, you're right it is not a good idea
to keep state in this object (at least not state of the art...). Any way,
yesterday night, I changed my mind in turn it to a SingleCall object.

Now, back to my initial problem. I really want to stop the remoting
functionality. This means no client will be able to connect any more from a
given point of time.
I do not really follow you when you say, "just stop the Server". In fact, my
"remoting Server" will be hosted within a process that will keep running
eventhough the remoting functionality is stopped.

So, is there any method to call to stop the remoting server?

To start it --------> RemotingConfiguration.Configure().
To stop it:---------> ?????

Thanks,
-José
 
P

Peter Bradley

Presumably, your remote object is hosted within a Windows Service. This is
the usual method. If you want to cut your users off, just stop the service.
The first time you try to call a method on the remote object (NB: NOT when
you create the proxy instance, which is done exclusively on the client), an
exception will be thrown, because the Windows service will be stopped. The
actual error message says something about the server actively refusing
requests on that port.

All you need to do is to intercept that exception and send some nice,
friendly message to the user, along the lines of, "The service is
temporarily unavailable. Please try again later. In fact, you could put
the message in a config file so that you can alter it to suit your
circumstances.

Does that help?

This is all .NET 1.1 stuff, by the way. It might be even easier in 2.0. I
wouldn't know. Yet.


Peter
 
J

José Joye

Hello again,

No, it is not a windows Service. For several reason, this is not hosted in a
windows Service but in a normal process that has also other small taks to
perform.
This means I can not stop the service or terminate the process.

- José
 
G

Guest

Jose,

I am in the same (or similar) boat with you on this. For a while, I've been
wanting to stop (or prohibit) server object providing any further services to
client although the [Window] service itself (or any other ways your server
object may be hosted) is still running. One scenario of this is the service
hosts 3 server objects, and I want to prohibit on one [at runtime] while
leaving the other 2 running. How do I do that?

Apparently, it's not obvious and as far as I know, there's none. My thinking
is that you just have to somehow play trick inside your object to intercept
every (yes, every) single call to check for whether the object is currently
available for service or not. That also means your object is not stopped;
it's just not providing services.

I hope that helps.
 
J

José Joye

Hello,

Thanks for your feedback,

In fact I still did not find any viable solution to the problem. I'm
wondering if the ChannelServices.UnregisterChannel() Method .
I will try it in the next days....

- José

mtv said:
Jose,

I am in the same (or similar) boat with you on this. For a while, I've
been
wanting to stop (or prohibit) server object providing any further services
to
client although the [Window] service itself (or any other ways your server
object may be hosted) is still running. One scenario of this is the
service
hosts 3 server objects, and I want to prohibit on one [at runtime] while
leaving the other 2 running. How do I do that?

Apparently, it's not obvious and as far as I know, there's none. My
thinking
is that you just have to somehow play trick inside your object to
intercept
every (yes, every) single call to check for whether the object is
currently
available for service or not. That also means your object is not stopped;
it's just not providing services.

I hope that helps.

--
Your 2 cents are worth $milion$. Thanks.


José Joye said:
Hello,

What is the best way to stop a remoting server (Singleton SAO) that has
been
started with RemotingConfiguration.Configure().
For sure, I want to do this without quitting the application :)

In fact, at a given time based on an internal event, I would like to stop
the remoting functionality within my process.

Many thanks,

- José
 
G

Guest

If you host multiple remote objects [by a single host] like mine,
unregistering will shut down availability for all objects. So, if you have
one object per service, it will work but that is not much different from
shutting down the service itself.

What's your architecture like? BTW, have you checked out Genuine Channels
component? It may provide this feature.


--
Your 2 cents are worth $milion$. Thanks.


José Joye said:
Hello,

Thanks for your feedback,

In fact I still did not find any viable solution to the problem. I'm
wondering if the ChannelServices.UnregisterChannel() Method .
I will try it in the next days....

- José

mtv said:
Jose,

I am in the same (or similar) boat with you on this. For a while, I've
been
wanting to stop (or prohibit) server object providing any further services
to
client although the [Window] service itself (or any other ways your server
object may be hosted) is still running. One scenario of this is the
service
hosts 3 server objects, and I want to prohibit on one [at runtime] while
leaving the other 2 running. How do I do that?

Apparently, it's not obvious and as far as I know, there's none. My
thinking
is that you just have to somehow play trick inside your object to
intercept
every (yes, every) single call to check for whether the object is
currently
available for service or not. That also means your object is not stopped;
it's just not providing services.

I hope that helps.

--
Your 2 cents are worth $milion$. Thanks.


José Joye said:
Hello,

What is the best way to stop a remoting server (Singleton SAO) that has
been
started with RemotingConfiguration.Configure().
For sure, I want to do this without quitting the application :)

In fact, at a given time based on an internal event, I would like to stop
the remoting functionality within my process.

Many thanks,

- José
 
G

Guest

Have a few questions if you will:

1. Does SockPro support server's custom events that can be subscribed on
Client? Ex: server notifies clients via events upon something happened on the
server side.
2. Are there any size/obj type limitations in transferring data b/t client
and server?
3. Can it server synchronously multiple clients in parallel using some sort
of threading architecture? Ex: Many Clients call GetData() that returns a
dataset. How does SockPro work with these calls in parallel and synchronous
mode?

Since I use .Net remoting, feel free to compare/constrast SockPro to it. If
you prefer to discuss offline, please provide your email/phone.

Thanks.
 
M

msgroup

Hi, mtv:

See my inline comments.

mtv said:
Have a few questions if you will:

1. Does SockPro support server's custom events that can be subscribed on
Client? Ex: server notifies clients via events upon something happened on
the
server side.

Our SocketPro has a BUILT-IN real-time communication service (chat or
notification service) without writing your own code, because it is a
built-in service for free. See the site
http://www.udaparts.com/document/articles/chatservice.htm. See the real
application that is written from our SocketPro at
http://www.wramp.net/casestudies1.html and
http://www.udaparts.com/groups/viewtopic.php?t=39.
2. Are there any size/obj type limitations in transferring data b/t client
and server?

No size/obj type limitations at all. Our SocketPro also fully supports .NET
serialization and de-serialization, in addition to own class helper.

3. Can it server synchronously multiple clients in parallel using some
sort
of threading architecture? Ex: Many Clients call GetData() that returns a
dataset. How does SockPro work with these calls in parallel and
synchronous
mode?

Our SocketPro is written from batching, asynchrony and parallel computation
with online compression. SocketPro uses 100% non-blocking for both client
and server communications. On client side, usually you don't need threads
but non-blocking sockets only. Go to www.udaparts.com, download SocketPro
and do reseach on five tutorials and other samples. You will gradually
understand our SocketPro. If you use our built-in real-time notification
service, it may help you write a much better distributed application.
Since I use .Net remoting, feel free to compare/constrast SockPro to it.
If
you prefer to discuss offline, please provide your email/phone.

You can post message into our discussion group at
http://www.udaparts.com/groups/viewforum.php?f=2. We can provide more detail
analysis for your project design, and give your extra suggestions.
 
S

Stuart Parker

Don't know how helpful this is but it's an idea.....

Stick a boolean property on your remote object to indicate if it can accept
requests or not. e.g. CanAcceptRequests.

Create a method on the remote object to return this value. e.g.
CheckCanAcceptRequests.

Before every call to the remote object, call the CheckCanAcceptRequests
method on the remote object ( or possibly just check to property directly).
If result is TRUE, then make the required method call to do processing....
if FALSE then don't call the method.

Trick would be to persist the CanAcceptRequests setting somewhere, and read
it back when a new Singleton object is created in the server as it doesnt
retain any state.

This means that your app can continue running, but you can deny any remote
method calls

Its a method I'm looking at using in a small project I have.

Stu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top