Master Initializing
557298
public function init()
    {
        // Avoid CLI Issues
        if (PHP_SAPI === 'cli') {
            return false;
        }
        // Cache bug // force creating first request
        elseif (!$this->requestStack->getCurrentRequest()) {
            $this->requestStack->push(Request::createFromGlobals());
        }

        // Master hostname
        $hostName = $this->requestStack->getCurrentRequest()->getHost();

        // Check config
        if (isset($this->config['enabled']) && $this->config['enabled'] === true) {
            // Fetch Host & map them
            foreach ($this->config['partners'] as $nodeName => $data) {
                // Transform Config
                $data['locals'] = $this->transformConfig($data['locals']);
                $data['globals'] = $this->transformConfig($data['globals']);

                // Get Hosts
                foreach ($data['hosts'] as $currentHostName) {
                    // Check host inexistence
                    if (!isset($this->hostConfigTable[$currentHostName])) {
                        // Get Config
                        $this->hostConfigTable[$currentHostName] = $data;
                    } else {
                        throw new WhiteLabelException(sprintf('The host "%s", in node "%s" is already defined in a previous partner node.', $currentHostName, $nodeName));
                    }
                }
            }

            // Find the partner
            if (isset($this->hostConfigTable[$hostName]) && isset($this->hostConfigTable[$hostName]['namespace'])) {
                // Write the namespace
                $partnerConfig = $this->hostConfigTable[$hostName];

                // Check if this partner is enabled
                if (!isset($partnerConfig['enabled']) || $partnerConfig['enabled'] === true) {
                    $this->context = $partnerConfig;
                    $this->locals = isset($partnerConfig['locals']) ? $partnerConfig['locals'] : [];
                }
            }
        }
    }
1108379
def sg_init(sess):
     
    """
    # initialize variables
    sess.run(tf.group(tf.global_variables_initializer(),
                      tf.local_variables_initializer()))
975963
function init() {
    network = [];
    netindex = new Int32Array(256);
    bias = new Int32Array(netsize);
    freq = new Int32Array(netsize);
    radpower = new Int32Array(netsize >> 3);

    var i, v;
    for (i = 0; i < netsize; i++) {
      v = (i << (netbiasshift + 8)) / netsize;
      network[i] = new Float64Array([v, v, v, 0]);
      //network[i] = [v, v, v, 0]
      freq[i] = intbias / netsize;
      bias[i] = 0;
    }
  }
76919
private void init() {
    mCallerContext = null;
    mImageRequest = null;
    mLowResImageRequest = null;
    mMultiImageRequests = null;
    mTryCacheOnlyFirst = true;
    mControllerListener = null;
    mControllerViewportVisibilityListener = null;
    mTapToRetryEnabled = false;
    mAutoPlayAnimations = false;
    mOldController = null;
    mContentDescription = null;
  }
679052
private void initialize()
   {
      m_frame = new JFrame();
      m_frame.setBounds(100, 100, 900, 451);
      m_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      m_frame.getContentPane().setLayout(new GridLayout(1, 0, 0, 0));

      final FileChooserModel fileChooserModel = new FileChooserModel();
      final FileChooserController fileChooserController = new FileChooserController(fileChooserModel);
      @SuppressWarnings("unused")
      FileChooserView fileChooserView = new FileChooserView(m_frame, fileChooserModel);
      fileChooserModel.setExtensions("cdpx", "cdpz", "fts", "gan", "gnt", "mdb", "mpp", "mpx", "pep", "planner", "pmxml", "pod", "pp", "ppx", "prx", "sp", "stx", "xer", "xml", "zip");

      final FileSaverModel fileSaverModel = new FileSaverModel();
      final FileSaverController fileSaverController = new FileSaverController(fileSaverModel);
      @SuppressWarnings("unused")
      FileSaverView fileSaverView = new FileSaverView(m_frame, fileSaverModel);
      fileSaverModel.setExtensions("sdef", "sdef", "mpx", "mpx", "planner", "xml", "pmxml", "xml", "json", "json", "mspdi", "xml");

      JMenuBar menuBar = new JMenuBar();
      m_frame.setJMenuBar(menuBar);

      JMenu mnFile = new JMenu("File");
      menuBar.add(mnFile);

      JMenuItem mntmOpen = new JMenuItem("Open File...");
      mnFile.add(mntmOpen);

      final JMenuItem mntmSave = new JMenuItem("Save As...");
      mntmSave.setEnabled(false);
      mnFile.add(mntmSave);

      //
      // Open file
      //
      mntmOpen.addActionListener(new ActionListener()
      {
         @Override public void actionPerformed(ActionEvent e)
         {
            fileChooserController.openFileChooser();
         }
      });

      //
      // Save file
      //
      mntmSave.addActionListener(new ActionListener()
      {
         @Override public void actionPerformed(ActionEvent e)
         {
            fileSaverController.openFileSaver();
         }
      });

      final JTabbedPane tabbedPane = new JTabbedPane(SwingConstants.TOP);
      m_frame.getContentPane().add(tabbedPane);

      PropertyAdapter<FileChooserModel> openAdapter = new PropertyAdapter<FileChooserModel>(fileChooserModel, "file", true);
      openAdapter.addValueChangeListener(new PropertyChangeListener()
      {
         @Override public void propertyChange(PropertyChangeEvent evt)
         {
            File file = fileChooserModel.getFile();
            tabbedPane.add(file.getName(), new ProjectFilePanel(file));
            mntmSave.setEnabled(true);
         }
      });

      PropertyAdapter<FileSaverModel> saveAdapter = new PropertyAdapter<FileSaverModel>(fileSaverModel, "file", true);
      saveAdapter.addValueChangeListener(new PropertyChangeListener()
      {
         @Override public void propertyChange(PropertyChangeEvent evt)
         {
            ProjectFilePanel panel = (ProjectFilePanel) tabbedPane.getSelectedComponent();
            panel.saveFile(fileSaverModel.getFile(), fileSaverModel.getType());
         }
      });

   }
30602
protected static function init()
    {
        // Start file.
        $backtrace        = debug_backtrace();
        self::$_startFile = $backtrace[count($backtrace) - 1]['file'];

        // Pid file.
        if (empty(self::$pidFile)) {
            self::$pidFile = __DIR__ . "/../" . str_replace('/', '_', self::$_startFile) . ".pid";
        }

        // Log file.
        if (empty(self::$logFile)) {
            self::$logFile = __DIR__ . '/../workerman.log';
        }
        $log_file = (string)self::$logFile;
        if (!is_file($log_file)) {
            touch($log_file);
            chmod($log_file, 0622);
        }

        // State.
        self::$_status = self::STATUS_STARTING;

        // For statistics.
        self::$_globalStatistics['start_timestamp'] = time();
        self::$_statisticsFile                      = sys_get_temp_dir() . '/workerman.status';

        // Process title.
        self::setProcessTitle('WorkerMan: master process  start_file=' . self::$_startFile);

        // Init data for worker id.
        self::initId();

        // Timer init.
        Timer::init();
    }
852158
public void init ()
  {
    m_nLeading = 0;
    while (m_nLeading < m_sValue.length () && m_sValue.charAt (m_nLeading) == ' ')
      m_nLeading++;

    if (m_nLeading == m_sValue.length ())
    {
      setEmpty ();
    }
    else
    {
      m_bIsEmpty = false;
      m_nTrailing = 0;
      while (m_sValue.charAt (m_sValue.length () - m_nTrailing - 1) == ' ')
        m_nTrailing++;
    }
  }
940826
def _set_master_state(self, state):
        """"""
        if state == 'init':
            self._service_state.update_current_state('init', force=True)
            self.set_state(DevState.INIT)

        elif state == 'on':
            self.set_state(DevState.ON)
            self._service_state.update_current_state('on')
843395
public function init()
    {
        $this->socketurl = sprintf($this->config->mastersocket->value,
            crc32(Daemon::$config->pidfile->value . "\x00" . Daemon::$config->user->value . "\x00" . Daemon::$config->group->value));
        if (Daemon::$process instanceof Thread\IPC) {
            $this->pool = MasterPool::getInstance(['listen' => $this->socketurl]);
            $this->pool->appInstance = $this;
            $this->pool->onReady();
        }
    }
1049954
function(master)
{
    var self = this;

    this.methods   = {};
    this.processes = {};
    this.master    = master;

    // Inject predefined methods
    var defaultIPCPath = __dirname + '/ipc/';
    fs.readdirSync(defaultIPCPath).forEach(function(file) {

        if (!file.match(/\.js$/)) {
            return;
        }

        var ObjectClass = require(defaultIPCPath + file);
        var obj         = new ObjectClass({master: master});
        var className   = file.replace(/\.js$/i, '');

        Object.getOwnPropertyNames(ObjectClass.prototype).forEach(function(method) {

            if ('constructor' === method) {
                return;
            }

            self.addMethod(className + '.' + method, obj[method], obj);
        });
    });
}
290907
private void init() {
        logger.info("metadata init().");

        writeLock.lock();
        try {
        // Required keys
        initCache(CLUSTER_KEY);

        // If stores definition storage engine is not null, initialize metadata
        // Add the mapping from key to the storage engine used
        if(this.storeDefinitionsStorageEngine != null) {
            initStoreDefinitions(null);
        } else {
            initCache(STORES_KEY);
        }

        // Initialize system store in the metadata cache
        initSystemCache();
        initSystemRoutingStrategies(getCluster());

        // Initialize with default if not present
        initCache(SLOP_STREAMING_ENABLED_KEY, true);
        initCache(PARTITION_STREAMING_ENABLED_KEY, true);
        initCache(READONLY_FETCH_ENABLED_KEY, true);
        initCache(QUOTA_ENFORCEMENT_ENABLED_KEY, true);
        initCache(REBALANCING_STEAL_INFO, new RebalancerState(new ArrayList<RebalanceTaskInfo>()));
        initCache(SERVER_STATE_KEY, VoldemortState.NORMAL_SERVER.toString());
        initCache(REBALANCING_SOURCE_CLUSTER_XML, null);
        initCache(REBALANCING_SOURCE_STORES_XML, null);


        } finally {
            writeLock.unlock();
        }
    }
802243
@Override
    protected void initializeImpl()
    {
        //initialize
        super.initializeImpl();

        //get temporary directory
        File directory=IOHelper.getFax4jInternalTemporaryDirectory();

        //get exe path
        String fax4jExe=Fax4jExeConstants.FAX4J_EXE.toString();
        File exeFile=new File(directory,fax4jExe);
        if(exeFile.exists())
        {
            this.fax4jExecutableFileLocation=exeFile.getPath();
        }
        else
        {
            exeFile=IOHelper.getFileFromNativePath(fax4jExe);
            if(exeFile!=null)
            {
                this.fax4jExecutableFileLocation=exeFile.getPath();
            }
        }

        //get fax server name
        this.faxServerName=WindowsFaxClientSpiHelper.getServerNameFromConfiguration(this);

        //set defaults
        this.useWindowsCommandPrefix=false;
    }
198045
private synchronized void init(AlluxioConfiguration alluxioConf) {
    mJobMasterInquireClient = MasterInquireClient.Factory.createForJobMaster(alluxioConf);
    mJobMasterClientPool =
        new JobMasterClientPool(JobMasterClientContext
            .newBuilder(ClientContext.create(alluxioConf)).build());
  }
247154
public boolean masterStarted() {
        if (objectMapper == null)
            objectMapper = new ObjectMapper();

        try {
            String type = objectMapper.readValue(
                            Unirest.get(String.format("http://%s:%d/opType", masterStatusHost, masterStatusPort)).asJson()
                                            .getBody().toString(),
                            ServerTypeJson.class).getType();
            if (!type.equals("master"))
                throw new IllegalStateException("Wrong opType " + type);
            Unirest.get(String.format("http://%s:%d/started", masterStatusHost, masterStatusPort)).asJson().getBody();
            return objectMapper.readValue(
                            Unirest.get(String.format("http://%s:%d/started", masterStatusHost, masterStatusPort))
                                            .asJson().getBody().toString(),
                            MasterStatus.class).started();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }
909356
def init(ctx, client, directory, name, force, use_external_storage):
    """"""
    if not client.use_external_storage:
        use_external_storage = False

    ctx.obj = client = attr.evolve(
        client,
        path=directory,
        use_external_storage=use_external_storage,
    )

    msg = 'Initialized empty project in {path}'
    branch_name = None

    stack = contextlib.ExitStack()

    if force and client.repo:
        msg = 'Initialized project in {path} (branch {branch_name})'
        merge_args = ['--no-ff', '-s', 'recursive', '-X', 'ours']

        try:
            commit = client.find_previous_commit(
                str(client.renku_metadata_path),
            )
            branch_name = 'renku/init/' + str(commit)
        except KeyError:
            from git import NULL_TREE
            commit = NULL_TREE
            branch_name = 'renku/init/root'
            merge_args.append('--allow-unrelated-histories')

        ctx.obj = client = stack.enter_context(
            client.worktree(
                branch_name=branch_name,
                commit=commit,
                merge_args=merge_args,
            )
        )

    try:
        with client.lock:
            path = client.init_repository(name=name, force=force)
    except FileExistsError:
        raise click.UsageError(
            'Renku repository is not empty. '
            'Please use --force flag to use the directory as Renku '
            'repository.'
        )

    stack.enter_context(client.commit())

    with stack:
        # Install Git hooks.
        from .githooks import install
        ctx.invoke(install, force=force)

        # Create all necessary template files.
        from .runner import template
        ctx.invoke(template, force=force)

    click.echo(msg.format(path=path, branch_name=branch_name))
481342
private void initAST() {
    jsRoot = IR.root();
    externsRoot = IR.root();
    externAndJsRoot = IR.root(externsRoot, jsRoot);
  }
260417
def start_system(components, bind_to, hooks={}):
    """"""
    deps = build_deps_graph(components)
    started_components = start_components(components, deps, None)

    run_hooks(hooks, started_components)

    if type(bind_to) is str:
        master = started_components[bind_to]
    else:
        master = bind_to

    setattr(master, '__components', started_components)
    return master