public virtual void Bind(IRemotableCreekController controller) { if (controller == null) { throw new ArgumentNullException("controller"); } if (!typeof(MarshalByRefObject).IsAssignableFrom(controller.GetType())) { throw new ArgumentException("Exported controller must be of type MarshallByRefObject", "controller"); } try { // Expose the object directly by leveraging the already registered channels done by Quartz Scheduler RemotingServices.Marshal((MarshalByRefObject)controller, controller.GetType().Name); log.Info(string.Format(CultureInfo.InvariantCulture, "Successfully marhalled remotable controller under name '{0}'", controller.GetType().Name)); } catch (RemotingException ex) { log.Error("RemotingException during Bind", ex); } catch (SecurityException ex) { log.Error("SecurityException during Bind", ex); } catch (Exception ex) { log.Error("Exception during Bind", ex); } }
public virtual void UnBind(IRemotableCreekController controller) { if (controller == null) { throw new ArgumentNullException("controller"); } if (!typeof(MarshalByRefObject).IsAssignableFrom(controller.GetType())) { throw new ArgumentException("Exported controller must be of type MarshallByRefObject", "controller"); } try { RemotingServices.Disconnect((MarshalByRefObject)controller); log.Info("Successfully disconnected remotable controller"); } catch (ArgumentException ex) { log.Error("ArgumentException during Unbind", ex); } catch (SecurityException ex) { log.Error("SecurityException during Unbind", ex); } catch (Exception ex) { log.Error("Exception during Unbind", ex); } }