Invoke with the object monitor held
198068
private void cancelScan() {
        if (rescanIncompleteTask != null) {
            rescanIncompleteTask.cancel(true);
            rescanIncompleteTask = null;
        }
        if (rescanUndeployTask != null) {
            rescanUndeployTask.cancel(true);
            rescanUndeployTask = null;
        }
        if (scanTask != null) {
            scanTask.cancel(true);
            scanTask = null;
        }
    }
652731
public void invokeEndpointMethod(final Runnable invocation) {
        try {
            invokeEndpointTask.call(null, invocation);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
1201790
private void invokeOnComplete() {
        for (; ; ) {
            if (pooledBuffers != null) {
                for (PooledByteBuffer buffer : pooledBuffers) {
                    buffer.close();
                }
                pooledBuffers = null;
            }
            IoCallback callback = this.callback;
            this.buffer = null;
            this.fileChannel = null;
            this.callback = null;
            inCallback = true;
            try {
                callback.onComplete(exchange, this);
            } finally {
                inCallback = false;
            }

            StreamSinkChannel channel = this.channel;
            if (this.buffer != null) {
                long t = Buffers.remaining(buffer);
                final long total = t;
                long written = 0;

                try {
                    do {
                        long res = channel.write(buffer);
                        written += res;
                        if (res == 0) {
                            if(writeListener == null) {
                                initWriteListener();
                            }
                            channel.getWriteSetter().set(writeListener);
                            channel.resumeWrites();
                            return;
                        }
                    } while (written < total);
                    //we loop and invoke onComplete again
                } catch (IOException e) {
                    invokeOnException(callback, e);
                }
            } else if (this.fileChannel != null) {
                if(transferTask == null) {
                    transferTask = new TransferTask();
                }
                if (!transferTask.run(false)) {
                    return;
                }
            } else {
                return;
            }

        }
    }
544938
function renderObjectImmediate( object, program ) {

		object.render( function ( object ) {

			_this.renderBufferImmediate( object, program );

		} );

	}
704447
@SuppressWarnings("unchecked")
	public Object invoke(Object object) throws Exception {
		if (object == null) throw new NullPointerException("object");

		for (Invocation invocation : toChain()) {
			MethodDescriptor<Object, Object> unchecked =
					(MethodDescriptor<Object, Object>) invocation.method;
			object = unchecked.invoke(object, invocation.getArgsWithDefaults());
		}

		return object;
	}
192484
public static synchronized <T> T invokeMethod(Object object, Class<?> declaringClass, String methodToExecute,
			Class<?>[] parameterTypes, Object... arguments) throws Exception {
		return WhiteboxImpl.invokeMethod(object, declaringClass, methodToExecute, parameterTypes, arguments);
	}
706757
@Override
    public boolean invoke(Manager manager, Object event) {
        try {
            Object[] arguments = resolveArguments(manager, event);
            if (containsNull(arguments)) {
                return false;
            }
            if (!method.isAccessible()) {
                method.setAccessible(true);
            }
            method.invoke(target, arguments);
            return true;
        } catch (Exception e) {
            if (e instanceof InvocationTargetException) {
                Throwable cause = ((InvocationTargetException) e).getTargetException();
                // Exception already wrapped by another Observer down the chain.
                if (cause instanceof InvocationException) {
                    throw (InvocationException) cause;
                }
                throw new InvocationException(cause);
            }
            throw new InvocationException(e);
        }
    }
1346699
public void alarm(Object handle)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "alarm", handle);

    synchronized (this)
    {
      keepAliveAlarmHandle =
        am.create(parent.getMessageProcessor().getCustomProperties().get_browse_liveness_timeout(), this);
      parent.sendBrowseStatus(SIMPConstants.BROWSE_ALIVE, browseId);
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "alarm");
  }
1336802
function invoke(methodName) {
  var args = slice.call(arguments, 1)
  return function (object) {
    return object[methodName].apply(object, args)
  }
}
1004519
def invoke(self):
        

        # Don't sleep a hook if it has never run
        if self.timeout_milliseconds > 0:
            self.ready_time = (
                datetime.now() +
                timedelta(milliseconds=self.timeout_milliseconds))

        self.callback(self.callback_args)
818950
function invokeDebounced(vContext, vArguments) {
				cancelTimer();

				/**
				 * Executes a trailing invocation if it is enabled in the options.
				 *
				 * @param {boolean} [bFinal=true] Whether this is the final invocation.
				 */
				function _invoke(bFinal) {
					bFinal = bFinal !== false;
					if (bFinal) {
						cancel();
					}
					if (mOptions.trailing) {
						invoke(vContext, vArguments, null, bFinal);
					}
				}

				if (mOptions.requestAnimationFrame) {
					iTimerId = window.requestAnimationFrame(function() {
						_invoke();
					});
				} else {
					var iNow = Date.now();
					var iTimeSinceLastInvocation = iLastInvocationTime == null ? 0 : iNow - iLastInvocationTime;
					var iRemainingWaitTime = Math.max(0, bMaxWait ?
														 Math.min(mOptions.maxWait - iTimeSinceLastInvocation, mOptions.wait) :
														 mOptions.wait);
					var bMaxWaitInvocation = iRemainingWaitTime < mOptions.wait;

					iTimerId = setTimeout(function() {
						if (bMaxWaitInvocation) {
							var iTimerOvertime = Math.max(0, (Date.now() - iNow) - iRemainingWaitTime);
							var iCancelWaitTime = mOptions.wait - iRemainingWaitTime;
							if (iTimerOvertime > iCancelWaitTime) {
								// The timer took longer, maybe because of a long-running synchronous execution. No need to wait more.
								_invoke();
							} else {
								// Because there is some time left, the timer is restarted for cleanup. This is necessary for correct scheduling if
								// the debounced method is called again during this time.
								iTimerId = setTimeout(cancel, iCancelWaitTime - iTimerOvertime);
								_invoke(false);
							}
						} else {
							_invoke();
						}
					}, iRemainingWaitTime);
				}
			}
272568
function Observer(obj, keypath, callback, options) {
    this.options = options || {}
    this.options.adapters = this.options.adapters || {}
    this.obj = obj
    this.keypath = keypath
    this.callback = callback
    this.objectPath = []
    this.update = this.update.bind(this)
    this.parse()

    if (isObject(this.target = this.realize())) {
      this.set(true, this.key, this.target, this.callback)
    }
  }
879299
void handle(final IGPSObject object) {
		if (object instanceof TPVObject) {
			for (final IObjectListener l : this.listeners) {
				l.handleTPV((TPVObject) object);
			}
		} else if (object instanceof SKYObject) {
			for (final IObjectListener l : this.listeners) {
				l.handleSKY((SKYObject) object);
			}
		} else if (object instanceof ATTObject) {
			for (final IObjectListener l : this.listeners) {
				l.handleATT((ATTObject) object);
			}
		} else if (object instanceof SUBFRAMEObject) {
			for (final IObjectListener l : this.listeners) {
				l.handleSUBFRAME((SUBFRAMEObject) object);
			}
		} else if (object instanceof DevicesObject) {
			for (final IObjectListener l : this.listeners) {
				l.handleDevices((DevicesObject) object);
			}
		} else if (object instanceof DeviceObject) {
			for (final IObjectListener l : this.listeners) {
				l.handleDevice((DeviceObject) object);
			}
		} else {
			// object was requested, so put it in the response object
			synchronized (this.asyncWaitMutex) {
				this.asyncResult = object;
				this.asyncWaitMutex.notifyAll();
			}
		}
	}
1144504
@Override
    public Object invoke(Object[] vals) throws InvocationTargetException {
        Object[] tmp;
        int i;

        try {
            if (isStatic()) {
                return meth.invoke(null, vals);
            } else {
                if (vals.length == 0) {
                    throw new IllegalArgumentException("invalid arguments");
                }

                tmp = new Object[vals.length - 1];
                for (i = 1; i < vals.length; i++) {
                    tmp[i-1] = vals[i];
                }

                return meth.invoke(vals[0], tmp);
            }
        } catch (InvocationTargetException | IllegalArgumentException e) {
            throw e;
        } catch (IllegalAccessException e) {
            // isValid should prevent this
            throw new RuntimeException("can't access method");
        }
    }
244227
def invoke_task(self, method, **kwargs):
        
        # Don't execute methods which don't return a Task object
        if not method.endswith('_Task'):
            logger.error('invoke_task can only be used for methods which '
                  'return a ManagedObjectReference to a Task.')
            return None

        task_mo_ref = self.invoke(method=method, **kwargs)
        task = Task(task_mo_ref, self)
        task.update_view_data(properties=['info'])
        # TODO: This returns true when there is an error
        while True:
            if task.info.state == 'success':
                return task
            elif task.info.state == 'error':
                # TODO: Handle error checking properly
                raise TaskFailedError(task.info.error.localizedMessage)

            # TODO: Implement progresscallbackfunc
            # Sleep two seconds and then refresh the data from the server
            time.sleep(2)
            task.update_view_data(properties=['info'])
406789
def monitor(interests=:rw)
      @monitor ||= begin
        raise @error if @error
        monitor = @ioloop.add_io_wait(@io, interests) {callback_on_waiting}
        ObjectSpace.define_finalizer(self, self.class.finalizer(monitor))
        monitor
      end
    end
1185539
public void monitorEnter(Local<?> monitor) {
        addInstruction(new ThrowingInsn(Rops.MONITOR_ENTER, sourcePosition,
                RegisterSpecList.make(monitor.spec()), catches));
    }