예제 #1
0
        public virtual void Bind(IRemotableSchedulerScheduler scheduler)
        {
            if (scheduler == null)
            {
                throw new ArgumentNullException("scheduler");
            }
            if (!typeof(MarshalByRefObject).IsAssignableFrom(scheduler.GetType()))
            {
                throw new ArgumentException("Exported scheduler must be of type MarshallByRefObject", "scheduler");
            }

            RegisterRemotingChannelIfNeeded();

            try
            {
                RemotingServices.Marshal((MarshalByRefObject) scheduler, bindName);
                Log.Info(string.Format(CultureInfo.InvariantCulture, "Successfully marhalled remotable scheduler under name '{0}'", bindName));
            }
            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);
            } 
        }
예제 #2
0
		protected virtual SchedulerException InvalidateHandleCreateException(string msg, Exception cause)
		{
			rsched = null;
			SchedulerException ex = new SchedulerException(msg, cause);
			ex.ErrorCode = SchedulerException.ErrorCommunicationFailure;
			return ex;
		}
예제 #3
0
 public virtual void UnBind(IRemotableSchedulerScheduler scheduler)
 {
     if (scheduler == null)
     {
         throw new ArgumentNullException("scheduler");
     }
     if (!typeof(MarshalByRefObject).IsAssignableFrom(scheduler.GetType()))
     {
         throw new ArgumentException("Exported scheduler must be of type MarshallByRefObject", "scheduler");
     } 
     
     try
     {
         RemotingServices.Disconnect((MarshalByRefObject) scheduler);
         Log.Info("Successfully disconnected remotable sceduler");
     }
     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);
     } 
 }
예제 #4
0
		protected virtual IRemotableSchedulerScheduler GetRemoteScheduler()
		{
			if (rsched != null)
			{
				return rsched;
			}

			try
			{

				rsched =
					(IRemotableSchedulerScheduler)
					Activator.GetObject(typeof (IRemotableSchedulerScheduler), RemoteSchedulerAddress);
			}
			catch (Exception e)
			{
				SchedulerException initException =
					new SchedulerException(string.Format(CultureInfo.InvariantCulture, "Could not get handle to remote scheduler: {0}", e.Message), e);
				initException.ErrorCode = SchedulerException.ErrorCommunicationFailure;
				throw initException;
			}

			return rsched;
		}