Refresh the configuration asynchronously
551417
private void reConfigureAsynchronously() {
        refreshCount.incrementAndGet();
        if (pendingRefreshes.incrementAndGet() == 1) {
            executorPool.submit(new Runnable() {
                @Override
                public void run() {
                    do {
                        try {
                            Thread.sleep(MIN_DELAY_BETWEEN_REFRESHES);
                            logger.info("Configuring log4j dynamically");
                            reconfigure();
                        } 
                        catch (Exception th) {
                            logger.error("Cannot dynamically configure log4j :", th);
                        }
                    } while (0 != pendingRefreshes.getAndSet(0));
                }
            });
        }
    }
1334147
def _reload_maybe(self):
        
        ConfigModel = apps.get_model('djconfig.Config')

        data = dict(
            ConfigModel.objects
                .filter(key='_updated_at')
                .values_list('key', 'value'))

        if (not hasattr(self, '_updated_at') or
                self._updated_at != data.get('_updated_at')):
            self._reload()
650950
def refresh_plugin(self, new_path=None, force_current=True):
        """"""
        self.fileexplorer.treewidget.update_history(new_path)
        self.fileexplorer.treewidget.refresh(new_path,
                                             force_current=force_current)
448452
def refresh_if_needed(self):
        
        if self.state in (self.PENDING, self.STARTED):
            try:
                response, = self._fetch_result()['tasks']
            except (KeyError, ValueError):
                raise Exception(
                    "Unable to find results for task."
                )

            if 'error' in response:
                self.state == self.FAILURE
                raise ServerError(response['error'])

            if 'state' in response:
                self.state = response['state']
                self.result = response['result']
891985
function refresh() {
        $this->client = new $this->clientClassName($this->accessToken, $this->spaceId, $this->cacher);
        $this->requestDecorator = new RequestDecorator();
        $this->requestDecorator->setResource($this->resourceName);
    }
165797
def refresh_druid(datasource, merge):
    """"""
    session = db.session()
    from superset.connectors.druid.models import DruidCluster
    for cluster in session.query(DruidCluster).all():
        try:
            cluster.refresh_datasources(datasource_name=datasource,
                                        merge_flag=merge)
        except Exception as e:
            print(
                "Error while processing cluster '{}'\n{}".format(
                    cluster, str(e)))
            logging.exception(e)
        cluster.metadata_last_refreshed = datetime.now()
        print(
            'Refreshed metadata from cluster '
            '[' + cluster.cluster_name + ']')
    session.commit()
912450
async def updateconfig(self):
        ""
        exists = {}
        for s in self.connections:
            exists[(s.protocol.vhost, s.rawurl)] = s
        self._createServers(self, '', exists = exists)
        for _,v in exists.items():
            await v.shutdown()
            self.connections.remove(v)
1035857
def refresh(self, new_path=None, force_current=False):
        """"""
        if new_path is None:
            new_path = getcwd_or_home()
        if force_current:
            index = self.set_current_folder(new_path)
            self.expand(index)
            self.setCurrentIndex(index)
        self.set_previous_enabled.emit(
                             self.histindex is not None and self.histindex > 0)
        self.set_next_enabled.emit(self.histindex is not None and \
                                   self.histindex < len(self.history)-1)
        # Disable the view of .spyproject. 
        self.filter_directories()
988712
def async_update(self, event, reason={}):
        
        reason['attr'] = []
        for data in ['state', 'config']:
            changed_attr = self.update_attr(event.get(data, {}))
            reason[data] = data in event
            reason['attr'] += changed_attr
        super().async_update(event, reason)
300365
def refresh(self, index=None):
        """"""
        if index is None:
            index = self.get_stack_index()
        # Set current editor
        if self.get_stack_count():
            index = self.get_stack_index()
            finfo = self.data[index]
            editor = finfo.editor
            editor.setFocus()
            self._refresh_outlineexplorer(index, update=False)
            self.__refresh_statusbar(index)
            self.__refresh_readonly(index)
            self.__check_file_status(index)
            self.__modify_stack_title()
            self.update_plugin_title.emit()
        else:
            editor = None
        # Update the modification-state-dependent parameters
        self.modification_changed()
        # Update FindReplace binding
        self.find_widget.set_editor(editor, refresh=False)
969412
def reload
      # Make sure we have a fresh cache after we reload
      config.cache.clear if config.cache.respond_to?(:clear)

      # Reload dependencies as well, if necessary
      ActiveSupport::Dependencies.clear if defined?(ActiveSupport::Dependencies)

      # Use current configuration, but skip bundle and autoloading initializers
      current_config = config.marshal_dump.dup
      current_config.merge! :skip_bundle => true#, :skip_autoloading => true)

      initialize current_config
    end
85006
def refresh(self):
        """"""
        url = CONST.AUTOMATION_ID_URL
        url = url.replace(
            '$AUTOMATIONID$', self.automation_id)

        response = self._abode.send_request(method="get", url=url)
        response_object = json.loads(response.text)

        if isinstance(response_object, (tuple, list)):
            response_object = response_object[0]

        if str(response_object['id']) != self.automation_id:
            raise AbodeException((ERROR.INVALID_AUTOMATION_REFRESH_RESPONSE))

        self.update(response_object)
155081
def refresh(self):
        
        data = self.machine.raw_snapshot_data(self.name)
        self._save(data)
1101372
public synchronized void refresh() {
        if (repositoriesJson != null) {
            initRepositoriesFromJson();
        }
        for (UpdateRepository updateRepository : repositories) {
            updateRepository.refresh();
        }
        lastPluginRelease.clear();
    }
852875
public function reload()
    {
        // Rebuild the configuration data
        // Re-init
        $this->init(
            array(
                self::CONFIG_KEY_FILE_PATH   => $this->getConfigFilePath(),
                ConfigInterface::KEY_CONTEXT => $this->getContext(),
            )
        );
    }
48858
function () {
    var done = this.async();
    var options = this.options();
    var data = this.data;

    // default settings, overwritten with user defined settings
    settings = {
      pattern_port: Array.isArray(data.ports) && data.ports[0] ? data.ports[0] : Array.isArray(options.ports) && options.ports[0] ? options.ports[0] : 7020,
      snapshot_port: Array.isArray(data.ports) && data.ports[1] ? data.ports[1] : Array.isArray(options.ports) && options.ports[1] ? options.ports[1] : 7040,
      wwwroot: data.wwwroot || options.wwwroot || 'public',
      src: data.src || options.src || 'public/patterns',
      files: data.files || options.files || [],
      dest: data.dest || options.dest || 'docs',
      snapshot: (data.snapshot !== undefined ? data.snapshot : (options.snapshot !== undefined ? options.snapshot : false)),
      index: data.index || options.index || null,
      css: data.css || options.css || ['global.css']
    };

    var primer;

    // local pattern folder (there are the html snapshots)
    if (settings.files.length > 0) {
      var patterns = settings.files;
      var patternsFolder = settings.src;

      // our main function that starts the process
      primer = function (cb) {
        handleFiles(patternsFolder, patterns, cb);
      };

    } else {
     var patternFolder = './' + settings.src;

      // our main function that starts the process
      primer = function (cb) {
        readPatterns(patternFolder, cb);
      };
    }

   

    // middleware to spit out 404 (in case a non existing ressource is request)
    // or to process the `non static` requests
    var middleware = function (req, resp) {
      if (req.url !== '/') {
        resp.writeHead(404, {
          'Content-Length': 0,
          'Content-Type': 'text/plain'
        });
        resp.end();
        return;
      }

      // 200, success, always
      resp.writeHead(200, {'Content-Type': 'text/html'});
      // run the primer with cb
      primer(resp.end.bind(resp));
    };

    // initialize the server with static routes & dynamic template middleware
    var liveServer = connect.createServer(
      connect.static(process.cwd() + '/' + settings.wwwroot),
      middleware
    );

    // initialize the static server pointing to your snapshots
    var snapshotServer = connect.createServer(connect.static(process.cwd() + '/' + settings.dest));

    // starts the live server
    var startLiveServer = function () {
      liveServer.listen(settings.pattern_port, function () {
        grunt.log.ok('You can now visit http://localhost:' + settings.pattern_port + '/ to see your patterns.');
      });
    };

    // starts the snapshot server
    var startSnapshotServer = function () {
      snapshotServer.listen(settings.snapshot_port, function () {
        grunt.log.ok('You can now visit http://localhost:' + settings.snapshot_port + '/ to see your snaphsot patterns.');
      });
    };

    // writes the task output to a file 
    var writeSnapshot = function () {
      primer(function (content) {
        var promises = [];
        // write the index file
        grunt.file.write('./' + settings.dest + '/index.html', content);
        // copy css files
        settings.css.forEach(function (file) {
          var deferred = Q.defer();
          promises.push(deferred.promise);
          if (file.search('http://') !== -1) {

            var data = '';
            http.get(file, function (res) {
              res.on('data', function(chunk) {
                data += chunk;
              });
              res.on('end', function () {
                grunt.file.write('./' + settings.dest + '/style.css', data);
                deferred.resolve();
              });
            })
            .on('err', deferred.reject);
          } else {
            grunt.file.copy('./' + settings.wwwroot + '/' + file, './' + settings.dest + '/' + file);
            deferred.resolve();
          }
        });

        grunt.log.ok('Stand-alone output can now be found in "' + settings.dest + '/"');
        grunt.event.emit('patternprimer:snapshot:written');
        if (promises.length === 0) {
          done();
        } else {
          Q.allSettled(promises).then(done);
        }
      });
    };

    // writes to file or starts a server,
    // depending on the given snapshot var
    if (!!settings.snapshot) {
      writeSnapshot();
    } else {
      startLiveServer();
      // only start snapshot server, if snapshots are available
      if (grunt.file.exists('./' + settings.dest + '/index.html')) {
        startSnapshotServer();
      }
    }

  }
819062
def update(self):
        
        with open(os.path.join(self.config_dir, CONFIG_FILE_NAME), 'w') as config_file:
            self.config.write(config_file)