Handler which executes the `fallback_policy` once the queue size reaches
 `max_queue`.

 @param [Array] args
   The arguments to the task which is being handled.

 @!visibility private
339520
def handle_fallback(*args)
      case @fallback_policy
      when :abort
        raise RejectedExecutionError
      when :discard
        false
      when :caller_runs
        begin
          yield(*args)
        rescue => e
          Chef::Log.debug "Caught exception => #{e}"
        end
        true
      else
        fail "Unknown fallback policy #{@fallback_policy}"
      end
    end
1245374
function execute(args) {
    try {
        const currentOptions = options.parse(args)
        return executeOptions(currentOptions)
    } catch (error) {
        console.error(error.message)
        return 1
    }
}
652093
function taskList( arg, callback ){
    exec( taskListPath + arg, function( err, stdout ){
        callback( err, stdout )
    })
}
1311797
private void doAcquireSharedInterruptibly(int arg)
        throws InterruptedException {
        final Node node = addWaiter(Node.SHARED);
        try {
            for (;;) {
                final Node p = node.predecessor();
                if (p == head) {
                    int r = tryAcquireShared(arg);
                    if (r >= 0) {
                        setHeadAndPropagate(node, r);
                        p.next = null; // help GC
                        return;
                    }
                }
                if (shouldParkAfterFailedAcquire(p, node) &&
                    parkAndCheckInterrupt())
                    throw new InterruptedException();
            }
        } catch (Throwable t) {
            cancelAcquire(node);
            throw t;
        }
    }
532912
function (err, params) {
                if (!err) {
                  callback && callback(null, params);
                }
                else {
                  callback && callback(err.message || err);
                }
              }
395737
def run_callbacks_for(name, args, reverse)
      callbacks_for(name, reverse).map do |block|
        run_callback(block, args)
      end
    end
792864
def _queue_task(self, args):
        '''  '''
        if self._cancel_called:
            raise AsperaTransferQueueError("Cancel already called")
        elif self._wait_called:
            raise AsperaTransferQueueError("Cant queue items during wait")
        elif self.waiting_coordinator_count() >= self._config.max_submission_queue_size:
            raise AsperaTransferQueueError("Max queued items reached")
        else:
            _coordinator = AsperaTransferCoordinator(args)
            _components = {'meta': TransferMeta(args, transfer_id=args.transfer_id),
                           'coordinator': _coordinator}

            _transfer_future = AsperaTransferFuture(**_components)
            _coordinator.add_subscribers(args.subscribers, future=_transfer_future)
            _coordinator.add_done_callback(self.remove_aspera_coordinator,
                                           transfer_coordinator=_coordinator)
            self.append_waiting_queue(_coordinator)

            if not self._processing_thread:
                self._processing_thread = threading.Thread(target=self._process_waiting_queue)
                self._processing_thread.daemon = True
                self._processing_thread.start()

            self._wakeup_processing_thread()

        return _transfer_future
427500
def _run_queued_callbacks(self):
        '''  '''
        for callback in self._queued_callbacks:
            try:
                callback()
            except Exception as ex:
                logger.error("Exception: %s" % str(ex))
585375
public static void main(String[] args) {

        if (args.length < 1) {
            System.out.println("Parameters:  method arg1 arg2 arg3 etc");
            System.out.println("");
            System.out.println("Methods:");
            System.out.println("    reloadpolicies");
            System.out.println("    migratedatastreamcontrolgroup");
            System.exit(0);
        }

        String method = args[0].toLowerCase();

        if (method.equals("reloadpolicies")) {
            if (args.length == 4) {
            try {
                    reloadPolicies(args[1], args[2], args[3]);
                System.out.println("SUCCESS: Policies have been reloaded");
                System.exit(0);
            } catch (Throwable th) {
                th.printStackTrace();
                System.err
                        .println("ERROR: Reloading policies failed; see above");
                System.exit(1);
            }
        } else {
            System.err.println("ERROR: Three arguments required: "
                    + "http|https username password");
            System.exit(1);
        }

        } else if (method.equals("migratedatastreamcontrolgroup")) {

            // too many args
            if (args.length > 10) {
                System.err.println("ERROR: too many arguments provided");
                System.exit(1);
    }

            // too few
            if (args.length < 7) {

                System.err.println("ERROR: insufficient arguments provided.  Arguments are: ");
                System.err.println("    protocol [http|https]"); // 1; 0 is method
                System.err.println("    user"); // 2
                System.err.println("    password"); // 3
                System.err.println("    pid - either"); // 4
                System.err.println("        a single pid, eg demo:object");
                System.err.println("        list of pids separated by commas, eg demo:object1,demo:object2");
                System.err.println("        name of file containing pids, eg file:///path/to/file");
                System.err.println("    dsid - either"); // 5
                System.err.println("        a single datastream id, eg DC");
                System.err.println("        list of ids separated by commas, eg DC,RELS-EXT");
                System.err.println("    controlGroup - target control group (note only M is implemented)"); // 6
                System.err.println("    addXMLHeader - add an XML header to the datastream [true|false, default false]"); // 7
                System.err.println("    reformat - reformat the XML [true|false, default false]"); // 8
                System.err.println("    setMIMETypeCharset - add charset=UTF-8 to the MIMEType [true|false, default false]"); // 9
                System.exit(1);
            }


            try {
                // optional args
                boolean addXMLHeader = getArgBoolean(args, 7, false);
                boolean reformat = getArgBoolean(args, 8, false);
                boolean setMIMETypeCharset = getArgBoolean(args, 9, false);;

                InputStream is = modifyDatastreamControlGroup(args[1], args[2], args[3], args[4], args[5], args[6], addXMLHeader, reformat, setMIMETypeCharset);

                IOUtils.copy(is, System.out);
                is.close();

                System.out.println("SUCCESS: Datastreams modified");
                System.exit(0);

            } catch (Throwable th) {
                th.printStackTrace();
                System.err
                .println("ERROR: migrating datastream control group failed; see above");
                System.exit(1);
            }


        } else {
            System.err.println("ERROR: unrecognised method " + method);
            System.exit(1);
        }
    }
1335830
def execute(args = nil)
      execute_task(args)
    rescue Interrupt => e
      raise e # Dont log if it's an interrupt
    rescue Exception => e
      Errdo.error(e, args) if Errdo.log_task_exceptions
      raise e
    end
742131
def run(*args)
      optparse(*args)

      options = {
        :env => :production,
        :host => @host,
        :port => @port
      }

      options.merge!(:server => @handler) if @handler

      App.run!(options)
    end
330945
function( context, args ) {
				if ( !locked ) {
					args = args || [];
					args = [ context, args.slice ? args.slice() : args ];
					queue.push( args );
					if ( !firing ) {
						fire();
					}
				}
				return this;
			}
1258202
function(start, handler, arg) {
		this.global = true;
		this.descend(start, handler, arg);
		this.global = false;
	}
222692
def call(procedure, args=nil, kwargs=nil, options={}, &callback)
      command = WampRails::Command::Call.new(procedure, args, kwargs, options, self)
      self._queue_command(command, callback)
    end
583985
function () {
        // Grab the first callback in the queue
        var c  = this.q[0],
            fn;

        // If there is no callback in the queue or the Chain is currently
        // in an execution mode, return
        if (!c) {
            this.fireEvent('end');
            return this;
        } else if (this.id) {
            return this;
        }

        fn = c.method || c;

        if (typeof fn === 'function') {
            var o    = c.scope || {},
                args = c.argument || [],
                ms   = c.timeout || 0,
                me   = this;
                
            if (!(args instanceof Array)) {
                args = [args];
            }

            // Execute immediately if the callback timeout is negative.
            if (ms < 0) {
                this.id = ms;
                if (c.until) {
                    for (;!c.until();) {
                        // Execute the callback from scope, with argument
                        fn.apply(o,args);
                    }
                } else if (c.iterations) {
                    for (;c.iterations-- > 0;) {
                        fn.apply(o,args);
                    }
                } else {
                    fn.apply(o,args);
                }
                this.q.shift();
                this.id = 0;
                return this.run();
            } else {
                // If the until condition is set, check if we're done
                if (c.until) {
                    if (c.until()) {
                        // Shift this callback from the queue and execute the next
                        // callback
                        this.q.shift();
                        return this.run();
                    }
                // Otherwise if either iterations is not set or we're
                // executing the last iteration, shift callback from the queue
                } else if (!c.iterations || !--c.iterations) {
                    this.q.shift();
                }

                // Otherwise set to execute after the configured timeout
                this.id = setTimeout(function () {
                    // Execute the callback from scope, with argument
                    fn.apply(o,args);
                    // Check if the Chain was not paused from inside the callback
                    if (me.id) {
                        // Indicate ready to run state
                        me.id = 0;
                        // Start the fun all over again
                        me.run();
                    }
                },ms);
            }
        }

        return this;
    }
190061
function (arg) {
            var request = arg.req;
            var reqId = request.id;
            // var method = request.method;
            var transport = arg.transport.instance || Aria.getClassRef(arg.transport.classpath);

            var transportCallback = {
                fn : this._handleResponse,
                scope : this,
                args : request
            };

            if (!transport.isReady) {
                // Wait for it to be ready
                return transport.init(reqId, transportCallback);
            }

            // Here we're going to make a request
            this.trafficUp += request.requestSize;

            transport.request(request, transportCallback);
        }
1162547
def argument(self, *args, **kwargs):
        

        if kwargs.get('required', True):
            raise TypeError(
                'In click framework, arguments are mandatory, unless marked required=False. '
                'Attempt to use configmanager as a fallback provider suggests that this is an optional option, '
                'not a mandatory argument.'
            )

        args, kwargs = _config_parameter(args, kwargs)
        return self._click.argument(*args, **kwargs)