<p>
Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
</p>
486041
public Date scheduleJob (final IJobDetail jobDetail, final ITrigger trigger) throws SchedulerException
  {
    return m_aSched.scheduleJob (jobDetail, trigger);
  }
1167837
public static void startScheduler(int threadPoolSize, String annotatedJobsPackageName)
      throws SundialSchedulerException {

    try {
      createScheduler(threadPoolSize, annotatedJobsPackageName);
      getScheduler().start();
    } catch (SchedulerException e) {
      throw new SundialSchedulerException("COULD NOT START SUNDIAL SCHEDULER!!!", e);
    }
  }
996384
public boolean pauseQuartzScheduler() {
        try {
            this.scheduler.standby();
            return true;
        } catch (SchedulerException e) {
            logger.error("error pausing quartz scheduler", e);
        }
        return false;
    }
1294355
public synchronized void runNow(String scheduledJobId) {
    ScheduledJob scheduledJob = getJob(scheduledJobId);

    try {
      JobKey jobKey = new JobKey(scheduledJobId, SCHEDULED_JOB_GROUP);
      if (quartzScheduler.checkExists(jobKey)) {
        // Run job now
        quartzScheduler.triggerJob(jobKey);
      } else {
        // Schedule with 'now' trigger
        Trigger trigger =
            newTrigger().withIdentity(scheduledJobId, SCHEDULED_JOB_GROUP).startNow().build();
        schedule(scheduledJob, trigger);
      }
    } catch (SchedulerException e) {
      LOG.error("Error runNow ScheduledJob", e);
      throw new MolgenisDataException("Error job runNow", e);
    }
  }
70793
@Override
  public void initialize(String name, final Scheduler scheduler) throws SchedulerException {

    logger.info("Registering Quartz shutdown hook.");

    Thread t =
        new Thread("Quartz Shutdown-Hook") {

          @Override
          public void run() {

            logger.info("Shutting down Quartz...");
            try {
              scheduler.shutdown();
            } catch (SchedulerException e) {
              logger.info("Error shutting down Quartz: " + e.getMessage(), e);
            }
          }
        };

    Runtime.getRuntime().addShutdownHook(t);
  }
642001
public void setScheduledInstanceSet(java.util.Collection<ScheduledInstance> scheduledInstanceSet) {
        if (scheduledInstanceSet == null) {
            this.scheduledInstanceSet = null;
            return;
        }

        this.scheduledInstanceSet = new com.amazonaws.internal.SdkInternalList<ScheduledInstance>(scheduledInstanceSet);
    }
1358562
@Override
  public Boolean call() throws Exception {

    // Guard to make sure we get called only once.
    if (isCalled) {
      return false;
    } else {
      isCalled = true;
    }

    if (job == null) {
      return false;
    }

    boolean success = false;
    // Schedule the job on the JobTracker and wait for it to complete.
    try {
     success = job.waitForCompletion(true);
    } catch (InterruptedException interuptus) {
      // We're told to stop, so honor that.
      // And restore interupt status.
      Thread.currentThread().interrupt();
      // Indicate that we should NOT run the postProcessor.
      success = false;
    }
    
    if (success && (postProcessor != null)) {
      success = postProcessor.call();
    }

    return success;
  }
412370
public static ScheduledFuture scheduleAtFixedRate(Runnable runnable, long periodInMilli) {
        /** 我们默认设定一个runnable生命周期与一个msgId一一对应 */
        Runnable proxied = wrapRunnable(runnable, null);
        return newSingleThreadScheduler().scheduleAtFixedRate(proxied, 0, periodInMilli, TimeUnit.MILLISECONDS);
    }
573729
@Override
    public void run() {
        Date actualExecutionTime = new Date();
        super.run();
        Date completionTime = new Date();
        synchronized (this.triggerContextMonitor) {
            this.triggerContext.update(this.scheduledExecutionTime, actualExecutionTime, completionTime);
            if (!this.currentFuture.isCancelled()) {
                schedule();
            }
        }
    }
645834
@Override
    @Transactional
    public synchronized void startAlertScheduling() {
        requireNotDisposed();
        if (_alertSchedulingThread != null && _alertSchedulingThread.isAlive()) {
            _logger.info("Request to start alert scheduling aborted as it is already running.");
        } else {
            _logger.info("Starting alert scheduling thread.");
            _alertSchedulingThread = new SchedulingThread("schedule-alerts", LockType.ALERT_SCHEDULING);
            _alertSchedulingThread.start();
            _logger.info("Alert scheduling thread started.");
        }
    }
847177
public Object invoke(Object proxy, Method method, Object[] args)
            throws Throwable {

        String methodName = method.getName();
        if (methodName.equals("getTargetContext")) {
            return target;
        } else if (methodName.equals("equals")) {
            // Only consider equal when proxies are identical.
            return (proxy == args[0] ? Boolean.TRUE : Boolean.FALSE);
        } else if (methodName.equals("hashCode")) {
            // Use hashCode of Connection proxy.
            return hashCode();
        } else if (methodName.equals("close")) {
            doCloseConnection(target, contextSource);
            return null;
        } else if (LdapTransactionUtils
                .isSupportedWriteTransactionOperation(methodName)) {
            // Store transaction data and allow operation to proceed.
            CompensatingTransactionUtils.performOperation(contextSource,
                    target, method, args);
            return null;
        } else {
            try {
                return method.invoke(target, args);
            } catch (InvocationTargetException e) {
                throw e.getTargetException();
            }
        }
    }
338105
@Override
    public void call(Subscriber<? super Job<K, V>> subscriber) {

        log.debug("onSubscribe()");
        if (subscriber.isUnsubscribed()) {
            return;
        }

        String subscriberId = getClass().getSimpleName() + "-" + id + "-" + subscriberIds.incrementAndGet();
        subscriber.onStart();

        try {
            Scheduler.Worker worker = scheduler.createWorker();

            GetJobsAction<K, V> getJobsAction = new GetJobsAction<K, V>(disqueConnectionSupplier, subscriberId, subscriber,
                    jobLocalityTracking, getJobsArgs);

            actions.add(getJobsAction);
            Subscription subscription = worker.schedulePeriodically(getJobsAction, 0, 10, TimeUnit.MILLISECONDS);
            getJobsAction.setSelfSubscription(subscription);

            if (improveLocalityTimeUnit != null && improveLocalityInterval > 0 && reconnectTrigger == null) {
                reconnectTrigger = worker.schedulePeriodically(new Action0() {
                    @Override
                    public void call() {
                        switchNodes();
                    }
                }, improveLocalityInterval, improveLocalityInterval, improveLocalityTimeUnit);
            }
        } catch (Exception e) {
            if (log.isDebugEnabled()) {
                log.debug("QueueListener.call caught an exception: {}", e.getMessage(), e);
            }
            subscriber.onError(e);
        }
    }
514753
public ModifySnapshotScheduleResult withNextInvocations(java.util.Collection<java.util.Date> nextInvocations) {
        setNextInvocations(nextInvocations);
        return this;
    }
276768
protected void defineProxyMethods(CtClass cc, CtClass orig) throws Exception {
//        cc.addMethod( CtMethod.make( "public void __setDispatcher( "+ DispatcherThread.class.getName()+" d ) { __target.__dispatcher(d); }", cc ) );
        CtMethod[] methods = getSortedPublicCtMethods(orig,false);

        for (int i = 0; i < methods.length; i++) {
            CtMethod method = methods[i];
            CtMethod originalMethod = method;
            if (method.getName().equals("getActor")) {
                ClassMap map = new ClassMap();
                map.put(Actor.class.getName(),Actor.class.getName());
                method = CtMethod.make( "public "+Actor.class.getName()+" getActor() { return __target; }", cc ) ;
            } else {
                ClassMap map = new ClassMap();
                map.fix(orig);
                map.fix(Actor.class.getName());
                method = new CtMethod(method, cc, map);
            }

            CtClass returnType = method.getReturnType();
            boolean isCallerSide = // don't touch
                    originalMethod.getAnnotation(CallerSideMethod.class) != null ||
                    (originalMethod.getName().equals("self"));// || originalMethod.getName().equals("future")); ??


            if ( isCallerSide ) {
                // verify callerside and inthread are not used
                Object[][] availableParameterAnnotations = originalMethod.getAvailableParameterAnnotations();
                CtClass[] parameterTypes = originalMethod.getParameterTypes();
                for (int j = 0; j < availableParameterAnnotations.length; j++) {
                    Object[] availableParameterAnnotation = availableParameterAnnotations[j];
                    if ( availableParameterAnnotation.length > 0 ) {
                        for (int k = 0; k < availableParameterAnnotation.length; k++) {
                            Object annot = availableParameterAnnotation[k];
                            if ( annot.toString().indexOf("kontraktor.annotations.InThread") > 0 ) {
                                throw new RuntimeException("cannot combine @CallerSide and @InThread, manually wrap callback using inThread(). method:"+originalMethod+" clz:"+orig);
                            }
                        }
                    }
                }
            }

            boolean allowed = //((method.getModifiers() & AccessFlag.ABSTRACT) == 0 ) &&
                    (method.getModifiers() & (AccessFlag.NATIVE|AccessFlag.FINAL|AccessFlag.STATIC)) == 0 &&
                    (method.getModifiers() & AccessFlag.PUBLIC) != 0 &&
                    !isCallerSide;
            // by default lock all method of object and actor
            allowed &= !originalMethod.getDeclaringClass().getName().equals(Object.class.getName()) &&
                       !originalMethod.getDeclaringClass().getName().equals(Actor.class.getName());

            // exceptions: async built-in actor methods that can be called
            if ( //originalMethod.getName().equals("executeInActorThread") || // needed again ! see spore
                // async methods at actor class. FIXME: add annotation
                 originalMethod.getName().equals("getSubMonitorables") ||
                 originalMethod.getName().equals("getReport") ||
                 originalMethod.getName().equals("askMsg") ||
                 originalMethod.getName().equals("tellMsg") ||
                 originalMethod.getName().equals("__unpublish") ||
                 originalMethod.getName().equals("__republished") ||
                 originalMethod.getName().equals("router$clientPing") ||
                 originalMethod.getName().equals("ping") ||
                 originalMethod.getName().equals("cyclic") ||
                 originalMethod.getName().equals("__submit") ||
                 originalMethod.getName().equals("execInThreadPool") ||
                 originalMethod.getName().equals("asyncstop") ||
                 originalMethod.getName().equals("receive") ||
                 originalMethod.getName().equals("complete") ||
                 originalMethod.getName().equals("close")
            )
            {
                allowed = true;
            }

            if (allowed) {
                boolean isVoid = returnType == CtPrimitiveType.voidType;
                boolean isCallbackCall = originalMethod.getAnnotation(AsCallback.class) != null;
                if (returnType != CtPrimitiveType.voidType && !returnType.getName().equals(IPromise.class.getName()) ) {
                    throw new RuntimeException("only void methods or methods returning IPromise allowed problematic method:"+originalMethod );
                }
                String conversion = "";
                Object[][] availableParameterAnnotations = originalMethod.getAvailableParameterAnnotations();
                CtClass[] parameterTypes = originalMethod.getParameterTypes();
                for (int j = 0; j < availableParameterAnnotations.length; j++) {
                    Object[] availableParameterAnnotation = availableParameterAnnotations[j];
                    if ( availableParameterAnnotation.length > 0 ) {
                        for (int k = 0; k < availableParameterAnnotation.length; k++) {
                            Object annot = availableParameterAnnotation[k];
                            if ( annot.toString().indexOf("kontraktor.annotations.InThread") > 0 ) {
                                if ( parameterTypes[j].getName().equals(Callback.class.getName()) ) {
                                    Log.Info(this,"InThread unnecessary when using built in Callback class. method:"+originalMethod+" clz:"+orig);
                                    continue;
                                }
                                if ( ! parameterTypes[j].isInterface() )
                                    throw new RuntimeException("@InThread can be used on interfaces only");
                                String an = Actor.class.getName();
                                conversion += an+" sender=("+an+")sender.get();";
                                conversion += "if ( sender != null ) { args[" + j + "] = sender.__scheduler.inThread(sender.__self, args[" + j + "]); }";
                                break;
                            }
                        }
                    }
                }
                String call = "__target.__enqueueCall( this, \""+method.getName()+"\", args, "+isCallbackCall+" );";
                if ( ! isVoid ) {
                    call = "return ("+originalMethod.getReturnType().getName()+") (Object)"+call;
                }
                String body = "{ Object args[] = $args;" +
                        conversion +
                        call+
                    "}";
                method.setBody(body);
                cc.addMethod(method);
            } else if ( (method.getModifiers() & (AccessFlag.NATIVE|AccessFlag.FINAL|AccessFlag.STATIC)) == 0 )
            {
                if (isCallerSide || method.getName().equals("toString") || method.getName().equals("__stopImpl") ) {
                } else if (
                    ! method.getName().equals("getActor") &&
                    ! method.getName().equals("delayed") &&
                    ! method.getName().equals("execInThreadPool")
                )
                {
                    method.setBody("throw new RuntimeException(\"can only call public methods on actor ref. method:'"+method.getName()+"\");");
                    cc.addMethod(method);
                } else {
                    cc.addMethod(method);
                }
            }
        }

//        methods = getSortedNonPublicCtMethods(orig);
//
//        for (int i = 0; i < methods.length; i++) {
//            CtMethod method = methods[i];
//            CtMethod originalMethod = method;
//            if (method.getName().equals("getActor")) {
//                ClassMap then = new ClassMap();
//                then.put(Actor.class.getName(),Actor.class.getName());
//                method = CtMethod.make( "public "+Actor.class.getName()+" getActor() { return __target; }", cc ) ;
//            } else {
//                ClassMap then = new ClassMap();
//                then.fix(orig);
//                method = new CtMethod(method, cc, then);
//            }
//
//            CtClass returnType = method.getReturnType();
//            // by default ignore all method of object and actor
//            boolean isObjectOrActor = !originalMethod.getDeclaringClass().getName().equals(Object.class.getName()) &&
//                    !originalMethod.getDeclaringClass().getName().equals(Actor.class.getName());
//
//            if (! isObjectOrActor &&
//                (method.getModifiers() & (AccessFlag.NATIVE|AccessFlag.FINAL|AccessFlag.STATIC)) == 0 )
//            {
//                method.setBody("throw new RuntimeException(\"can only call public methods on actor ref\");");
//                cc.addMethod(method);
//            }
//        }
    }
951919
private void createProxyListener() throws SIResourceException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "createProxyListener");

    // Create the proxy listener instance
    _proxyListener = new NeighbourProxyListener(_neighbours, this);

    /*
     * Now we can create our asynchronous consumer to listen on      
     * SYSTEM.MENAME.PROXY.QUEUE  Queue for receiving subscription
     * updates   
     */
    // 169897.1 modified parameters
    try
    {
      _proxyAsyncConsumer =
        _messageProcessor
          .getSystemConnection()
          .createSystemConsumerSession(
            _messageProcessor.getProxyHandlerDestAddr(), // destination name
            null, //Destination filter
            null, // SelectionCriteria - discriminator and selector
            Reliability.ASSURED_PERSISTENT, // reliability
            false, // enable read ahead
            false,
            null,
            false);

      // 169897.1 modified parameters

      _proxyAsyncConsumer.registerAsynchConsumerCallback(
        _proxyListener,
        0, 0, 1,
        null);

      _proxyAsyncConsumer.start(false);
    }
    catch (SIException e)
    {
      FFDCFilter.processException(
        e,
        "com.ibm.ws.sib.processor.proxyhandler.MultiMEProxyHandler.createProxyListener",
        "1:1271:1.96",
        this);
        
      SibTr.exception(tc, e);
      
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
        SibTr.exit(tc, "createProxyListener", "SIResourceException");
        
      // The Exceptions should already be NLS'd
      throw new SIResourceException(e);
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "createProxyListener");
  }
231835
public static void proxy(Class<?> declaringClass, String methodName, InvocationHandler invocationHandler) {
		assertInvocationHandlerNotNull(invocationHandler);
		if (declaringClass == null) {
			throw new IllegalArgumentException("declaringClass cannot be null");
		}
		if (methodName == null || methodName.length() == 0) {
			throw new IllegalArgumentException("methodName cannot be empty");
		}
		Method[] methods = Whitebox.getMethods(declaringClass, methodName);
		if (methods.length == 0) {
			throw new MethodNotFoundException(String.format("Couldn't find a method with name %s in the class hierarchy of %s", methodName,
					declaringClass.getName()));
		} else if (methods.length > 1) {
			throw new TooManyMethodsFoundException(String.format("Found %d methods with name %s in the class hierarchy of %s.", methods.length,
					methodName, declaringClass.getName()));
		}

		MockRepository.putMethodProxy(methods[0], invocationHandler);
	}
34386
public static <T extends Annotation> MethodInvokeProxy proxyByAnnotationTag(Object target,String tag,Object ...args)
	{
		Method m=findMethodByAnnotationTag(target,tag);
		if(m!=null)
		{
			return new MethodInvokeProxy(target, m, args);
		}
		return null;
	}