![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| ||||
| ||||
|
|
Hello I'm using a Remoting server (Singleton) and i would like to controle its destruction. Is there a kind of RemotingConfiguration.Disconfigure? |
|
And most important : Is there a way to call a function before disconnection? I mean, within the Dispatcher remoting thread, i create other threads to delegate the jobs that arrives throught Remoting. But, when I close the application (for the moment juste a little executable), the thread are not destroyed ! |
|
I just need a way to call Stop() for each thread but i can't find a way ! |
|
Since it's a singleton, i cannot have a pointer (scuse me, a reference) to the Remoting object, to be able to call a method that will call all the Stop... I tryed with the "destructor", but it is called ONLY if all other thread are destroyed, so i can't use it to destroy them... Any idea? And by the way, how can i set a name to the remoting threads (Client and Server) without putting it in every function? For the server, i put Thread.CurrentThread.Name = "jjdjd" in the constructor, which is called at the first connexion, but for the client, i don't find any way to do this properly... |
#3
| |||
| |||
|
|
Why you need this? If you just unregister the channels it > will be enough. |
|
Do you need to make some cleanup on thread end, or you just want it to die? Yes i have a method to call to kill them properly (with a timeout before |
|
If you create your own threads, you can name them. Remoting uses threads from the thread pool, so I'm not sure what are you after. ok i understand why i can't name them... damned. |
#4
| |||
| |||
|
|
How can i unregister server channels ? and client ? ChannelServices.UnregisterChannel Method |
|
Yes i have a method to call to kill them properly (with a timeout before slaughter them...) |
#5
| |||
| |||
|
#6
| |||||
| |||||
|
|
So how can i get the channel. I tryed ChannelServices.GetChannel but i can't find the good name... |
|
2) My second problem is more important: Is it not possible to be able to avoid usign application.ApplicationExit.. i would like not to use the system.windows.form namespace since it's not a Form windows and i want to be portable (on mono with no system.windows.form for instance). It will become a Windows Service or even a WebService so i don't think Application is a good class to use in this case.. In case of windows service, the service exposes a OnShutdown or whatever |
| No i would like to find a proper way to destroy everything FROM the MarshalByRefObject (just calling a Detroy method). What i can do is (not beautiful but the only thing i've found this far): - have a "global" static reference to the MarshalByRefObject object since it's a singleton (this reference will be initilised to "this" in all remoting exposed function just to be sure at the end i will have this damned reference). |
|
- At the end of the application i call a static method that will use the static reference to call a method like Destroy() or anything that will ends all threads and performs all cleanup. |
|
I don't think it's a "proper" way do you think these is a better way to call custom-cleanup methods ? |

#7
| |||
| |||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |