/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
REPEATER
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - intitialize
199311
function initRepeater () {
		// simulate network latency
		var loadDelays = ['300', '600', '900', '1200'];
		var sort = function (data, sortProperty, sortDirection) {
			var sortedData = _.sortBy(data, function (item) {
				return item[sortProperty];
			});

			// sort direction
			if (sortDirection === 'desc') {
				sortedData = sortedData.reverse();
			}

			return sortedData;
		};

		// list view setup
		var list = function (options, callback) {
			// build dataSource based with options
			var resp = {
				count: data.repeater.listData.length,
				items: [],
				page: options.pageIndex
			};

			// get start and end limits for JSON
			var i, l;
			resp.pages = Math.ceil(resp.count / (options.pageSize || 50));

			i = options.pageIndex * (options.pageSize || 50);
			l = i + (options.pageSize || 50);
			l = (l <= resp.count) ? l : resp.count;
			resp.start = i + 1;
			resp.end = l;

			// setup columns for list view
			resp.columns = [
				{
					label: 'Common Name',
					property: 'commonName',
					sortable: true,
					width: 600
				},
				{
					label: 'Latin Name',
					property: 'latinName',
					sortable: true,
					width: 600
				},
				{
					label: 'Appearance',
					property: 'appearance',
					sortable: true
				},
				{
					label: 'Sound',
					property: 'sound',
					sortable: true
				}
			];

			// add sample items to datasource
			for (i; i < l; i++) {
				// from data.js
				resp.items.push(data.repeater.listData[i]);
			}

			resp.items = sort(resp.items, options.sortProperty, options.sortDirection);

			// call and simulate latency
			setTimeout(function () {
				callback(resp);
			}, loadDelays[Math.floor(Math.random() * 4)]);
		};


		// thumbnail view setup
		var thumbnail = function (options, callback) {
			var sampleImageCategories = ['abstract', 'animals', 'business', 'cats', 'city', 'food', 'nature', 'technics', 'transport'];
			var numItems = 200;

			// build dataSource based with options
			var resp = {
				count: numItems,
				items: [],
				pages: (Math.ceil(numItems / (options.pageSize || 30))),
				page: options.pageIndex
			};

			// get start and end limits for JSON
			var i, l;
			i = options.pageIndex * (options.pageSize || 30);
			l = i + (options.pageSize || 30);
			resp.start = i + 1;
			resp.end = l;

			// add sample items to datasource
			for (i; i < l; i++) {
				resp.items.push({
					name: ('Thumbnail ' + (i + 1)),
					src: 'http://lorempixel.com/65/65/' + sampleImageCategories[Math.floor(Math.random() * 9)] + '/?_=' + i
				});
			}

			// call and simulate latency
			setTimeout(function () {
				callback(resp);
			}, loadDelays[Math.floor(Math.random() * 4)]);
		};

		// initialize repater
		$('#myRepeater').repeater({
			searchOnKeyPress: true,
			dataSource: function (options, callback) {
				if (options.view === 'list') {
					list(options, callback);
				} else if (options.view === 'thumbnail') {
					thumbnail(options, callback);
				}
			},
			list_noItemsHTML: 'no items found',
			thumbnail_noItemsHTML: 'no items found',
			views: {
				'list.list': {
					dataSource: function (options, callback) {
						list(options, callback);
					},
				},
				'thumbnail': {
					dataSource: function (options, callback) {
						thumbnail(options, callback);
					},
					thumbnail_infiniteScroll: {
						hybrid: true
					}
				},
				'list.frozen': {
					dataSource: function (options, callback) {
						list(options, callback);
					},
					list_selectable: false, // (single | multi)
					list_frozenColumns: 1
				}
			}
		});
	}
417470
public void initialize() throws DurableDataLogException {
        this.cacheManager.startAsync().awaitRunning();
        getSingleton(this.dataLogFactory, this.dataLogFactoryCreator).initialize();
        getSingleton(this.containerManager, this.segmentContainerManagerCreator).initialize();
    }
535851
public void reinitialize( HttpServletRequest request, HttpServletResponse response, ServletContext servletContext )
    {
        //
        // Cache the associated ModuleConfig.  This is used throughout the code, in places where the request
        // isn't available to do a lazy initialization.
        //
        super.reinitialize( request, response, servletContext );
    }
1283217
public void initialize(Context context, ResponseListener listener) {
        this.context = context;
        this.listener = (listener != null) ? listener : new ResponseListener() {
            final String message = "ResponseListener is not specified. Defaulting to empty listener.";

            @Override
            public void onSuccess(Response response) {
                logger.debug(message);
            }

            @Override
            public void onFailure(Response response, Throwable t, JSONObject extendedInfo) {
                logger.debug(message);
            }
        };

        logger.debug("AuthorizationRequestAgent is initialized.");
    }
40674
@Override
    public final void initialize(MixinImplementor mixinImplementor) {
        checkState(this.mixinImplementor == null, "Re-entry is not allowed.");

        this.mixinImplementor = checkNotNull(mixinImplementor, "mixinImplementor");
        try {
          initialize();
        }
        finally {
            this.mixinImplementor = null;
        }
    }
504702
public void initialize(final int appId, final String appSecret, final String bridgeId,
      final ServerInfo serverInfo, final CallStatsInitListener callStatsInitListener) {
    if (StringUtils.isBlank(appSecret)) {
      logger.error("intialize: Arguments cannot be null ");
      throw new IllegalArgumentException("intialize: Arguments cannot be null");
    }
    initialize(appId, new TokenGeneratorHs256(appSecret.toCharArray(), appId, bridgeId), bridgeId,
        serverInfo, callStatsInitListener);
  }
1121684
@Override
    @InterfaceAudience.Private
    public void beginReplicating() {
        // If we're still waiting to create the remote db, do nothing now. (This method will be
        // re-invoked after that request finishes; see -maybeCreateRemoteDB above.)

        Log.d(TAG, "%s: beginReplicating() called", this);

        // reset doneBeginReplicating
        doneBeginReplicating = false;

        // If we're still waiting to create the remote db, do nothing now. (This method will be
        // re-invoked after that request finishes; see maybeCreateRemoteDB() above.)
        if (creatingTarget) {
            Log.d(TAG, "%s: creatingTarget == true, doing nothing", this);
            return;
        }

        pendingSequences = Collections.synchronizedSortedSet(new TreeSet<Long>());
        try {
            maxPendingSequence = Long.parseLong(lastSequence);
        } catch (NumberFormatException e) {
            Log.w(TAG, "Error converting lastSequence: %s to long.  Using 0", lastSequence);
            maxPendingSequence = new Long(0);
        }

        filter = compilePushReplicationFilter();
        if (filterName != null && filter == null) {
            Log.w(TAG, "%s: No ReplicationFilter registered for filter '%s'; ignoring",
                    this, filterName);
        }

        // Now listen for future changes (in continuous mode):
        if (isContinuous() && isRunning()) {
            observing = true;
            db.addChangeListener(this);
        }

        // Process existing changes since the last push:
        long lastSequenceLong = 0;
        if (lastSequence != null) {
            lastSequenceLong = Long.parseLong(lastSequence);
        }
        ChangesOptions options = new ChangesOptions();
        options.setIncludeConflicts(true);
        Log.d(TAG, "%s: Getting changes since %d", this, lastSequenceLong);
        final RevisionList changes = db.changesSince(lastSequenceLong, options, filter, filterParams);
        if (changes.size() > 0) {
            Log.d(TAG, "%s: Queuing %d changes since %d", this, changes.size(), lastSequenceLong);
            // NOTE: Needs to submit changes into inbox from RemoteRequest thread for beginReplication.
            //       RemoteRequest thread is observed by pendingFuture, if using other thread to
            //       submit changes  into inbox, there are chance both inbox and pendingFutures are
            //       empty.
            submitRevisions(changes);
        } else {
            Log.d(TAG, "%s: No changes since %d", this, lastSequenceLong);
        }

        // process queued changes by `changed()` callback
        synchronized (changesLock) {
            for (RevisionInternal rev : queueChanges) {
                if (!changes.contains(rev)) {
                    pauseOrResume();
                    waitIfPaused();
                    addToInbox(rev);
                }
            }
            doneBeginReplicating = true;
        }
    }
85020
@Override
	public void preparePaintComponent(final Request request) {
		if (!this.isInitialised()) {
			// Give the repeater the list of data to display.
			repeater.setData(fetchDataList());

			// Remember that we've done the initialisation.
			this.setInitialised(true);
		}
	}
468388
private void renderRecipe() throws IOException {
		StringBuilder sb = new StringBuilder();

		// First pages
		if( ! Constants.GENERATED.equalsIgnoreCase( this.applicationTemplate.getName())) {
			sb.append( renderDocumentTitle());
			sb.append( renderPageBreak());

			sb.append( renderParagraph( this.messages.get( "intro" ))); //$NON-NLS-1$
			sb.append( renderPageBreak());

			sb.append( renderDocumentIndex());
			sb.append( renderPageBreak());

			sb.append( startTable());
			sb.append( addTableLine( this.messages.get( "app.name" ), this.applicationTemplate.getName())); //$NON-NLS-1$
			sb.append( addTableLine( this.messages.get( "app.qualifier" ), this.applicationTemplate.getVersion())); //$NON-NLS-1$
			sb.append( endTable());

			sb.append( renderApplicationDescription());
			sb.append( renderPageBreak());
			sb.append( renderSections( new ArrayList<String>( 0 )));

		} else {
			sb.append( renderDocumentIndex());
			sb.append( renderPageBreak());
		}

		// Render information about components
		sb.append( renderComponents());

		// Render information about facets
		sb.append( renderFacets());

		writeFileContent( sb.toString());
	}
329333
private synchronized void initOut() throws IOException
   {
      if (out == null)
      {
         OutputStream os = new IndexOutputStream(dir.createOutput(REDO_LOG));
         out = new BufferedWriter(new OutputStreamWriter(os));
      }
   }
889535
public void init(final SerializedDataTypeRegistry typeRegistry, final DeserializerRegistry deserRegistry,
            final SerializerRegistry serRegistry) {
        if (initialized) {
            throw new IllegalStateException("Instance already initialized - Don't call the init methods more than once");
        }
        this.typeRegistry = typeRegistry;
        for (final JsonbDeserializer<?> deserializer : deserializers) {
            if (deserializer instanceof DeserializerRegistryRequired) {
                if (deserRegistry == null) {
                    throw new IllegalStateException(
                            "There is at least one deserializer that requires a 'DeserializerRegistry', but you didn't provide one (deserializer="
                                    + deserializer.getClass().getName() + ")");
                }
                final DeserializerRegistryRequired des = (DeserializerRegistryRequired) deserializer;
                des.setRegistry(deserRegistry);
            }
            if (deserializer instanceof SerializedDataTypeRegistryRequired) {
                if (typeRegistry == null) {
                    throw new IllegalStateException(
                            "There is at least one deserializer that requires a 'SerializedDataTypeRegistry', but you didn't provide one (deserializer="
                                    + deserializer.getClass().getName() + ")");
                }
                final SerializedDataTypeRegistryRequired des = (SerializedDataTypeRegistryRequired) deserializer;
                des.setRegistry(typeRegistry);
            }
        }
        for (final JsonbSerializer<?> serializer : serializers) {
            if (serializer instanceof SerializerRegistryRequired) {
                if (serRegistry == null) {
                    throw new IllegalStateException(
                            "There is at least one serializer that requires a 'SerializerRegistry', but you didn't provide one (serializer="
                                    + serializer.getClass().getName() + ")");
                }
                final SerializerRegistryRequired ser = (SerializerRegistryRequired) serializer;
                ser.setRegistry(serRegistry);
            }
            if (serializer instanceof SerializedDataTypeRegistryRequired) {
                if (typeRegistry == null) {
                    throw new IllegalStateException(
                            "There is at least one serializer that requires a 'SerializedDataTypeRegistry', but you didn't provide one (serializer="
                                    + serializer.getClass().getName() + ")");
                }
                final SerializedDataTypeRegistryRequired ser = (SerializedDataTypeRegistryRequired) serializer;
                ser.setRegistry(typeRegistry);
            }
        }
        initialized = true;
    }
1024876
void initializeReader(long initialAllocationDelay) {
        boolean alreadyAdded = sync.updateState((state, updates) -> {
            if (state.getSegments(readerId) == null) {
                log.debug("Adding reader {} to reader grop. CurrentState is: {}", readerId, state);
                updates.add(new AddReader(readerId));
                return false;
            } else {
                return true;
            }
        });
        if (alreadyAdded) {
            throw new IllegalStateException("The requested reader: " + readerId
                    + " cannot be added to the group because it is already in the group. Perhaps close() was not called?");
        }
        long randomDelay = (long) (Math.random() * Math.min(initialAllocationDelay, sync.getState().getConfig().getGroupRefreshTimeMillis()));
        acquireTimer.reset(Duration.ofMillis(initialAllocationDelay + randomDelay));
    }
1121294
@Override
	protected final void remoteInit() throws JMSException
    {
        CreateDurableSubscriberQuery query = new CreateDurableSubscriberQuery();
        query.setSessionId(session.getId());
        query.setConsumerId(id);
        query.setTopic((Topic)destination);
        query.setMessageSelector(messageSelector);
        query.setNoLocal(noLocal);
        query.setName(subscriptionName);
        transportEndpoint.blockingRequest(query);
    }
369086
function initRepeaterActions () {
		var loadDelays = ['300', '600', '900', '1200'];

		var sort = function (data, sortProperty, sortDirection) {
			var sortedData = _.sortBy(data, function (item) {
				return item[sortProperty];
			});

			// sort direction
			if (sortDirection === 'desc') {
				sortedData = sortedData.reverse();
			}

			return sortedData;
		};

		function getSampleDataSet (options, callback) {
			var resp = {
				count: data.repeater.listData.length,
				items: [],
				page: options.pageIndex
			};

			// get start and end limits for JSON
			var i, l;
			resp.pages = Math.ceil(resp.count / (options.pageSize || 50));

			i = options.pageIndex * (options.pageSize || 50);
			l = i + (options.pageSize || 50);
			l = (l <= resp.count) ? l : resp.count;
			resp.start = i + 1;
			resp.end = l;

			// setup columns for list view
			resp.columns = [
				{
					label: 'Common Name',
					property: 'commonName',
					sortable: true
				},
				{
					label: 'Latin Name',
					property: 'latinName',
					sortable: true
				},
				{
					label: 'Appearance',
					property: 'appearance',
					sortable: true
				},
				{
					label: 'Sound',
					property: 'sound',
					sortable: true
				}
			];

			// add sample items to datasource
			for (i; i < l; i++) {
				// from data.js
				resp.items.push(data.repeater.listData[i]);
			}

			resp.items = sort(resp.items, options.sortProperty, options.sortDirection);

			// call and simulate latency
			setTimeout(function () {
				callback(resp);
			}, loadDelays[Math.floor(Math.random() * 4)]);

		}

		// initialize the repeater
		var repeaterActions = $('#myRepeaterActions');
		repeaterActions.repeater({
			list_noItemsHTML: '<span>foo</span>',
			list_highlightSortedColumn: true,
			list_selectable: 'multi',
			list_actions: {
				width: 37,
				items: [
					{
						name: 'edit',
						html: '<span class="glyphicon glyphicon-pencil"></span> Edit'
					},
					{
						name: 'copy',
						html: '<span class="glyphicon glyphicon-copy"></span> Copy'
					},
					{
						name: 'delete',
						html: '<span class="glyphicon glyphicon-trash"></span> Delete',
						clickAction: function (helpers, callback, e) {
							console.log('hey it worked');
							console.log(helpers);
							e.preventDefault();
							callback();
						}
					}
				]
			},
			// setup your custom datasource to handle data retrieval;
			// responsible for any paging, sorting, filtering, searching logic
			dataSource: getSampleDataSet
		});
	}
1008000
private void ensureFxmlLoaderInitialized() {

		if (fxmlLoader != null) {
			return;
		}

		fxmlLoader = loadSynchronously(resource, bundle);
		presenterProperty.set(fxmlLoader.getController());
	}
2938
@Synchronized
    @SneakyThrows(Exception.class)
    private void tryInit() {
        if (!zkInit) {
            // we are making remote calls under a lock but this is only done for initialization at 
            // the start of controller process.
            ZKUtils.createPathIfNotExists(zkClient, zkPath, HostContainerMap.EMPTY.toBytes());
            hostContainerMapNode.getListenable().addListener(this::updateMap);
            hostContainerMapNode.start(true);
            updateMap();
            zkInit = true;
        }
    }
1080377
public synchronized final void initialize() throws RepositoryException {
        if (!initialized) {
            try {
                doInitialize();
                initialized = true;
            } catch (RuntimeException e) {
                throw new RepositoryException(e);
            }
        }
    }