Search in sources :

Example 26 with Start

use of org.infinispan.factories.annotations.Start in project infinispan by infinispan.

the class ClusterTopologyManagerImpl method start.

@Start(priority = 100)
public void start() {
    helper = new TopologyManagementHelper(gcr);
    joinViewFuture = new ConditionFuture<>(timeoutScheduledExecutor);
    actionSequencer = new ActionSequencer(nonBlockingExecutor, true, timeService);
    cacheManagerNotifier.addListener(viewListener);
    // The listener already missed the initial view
    handleClusterView(false, transport.getViewId());
    globalRebalancingEnabled = join(fetchRebalancingStatusFromCoordinator(INITIAL_CONNECTION_ATTEMPTS));
}
Also used : ActionSequencer(org.infinispan.util.concurrent.ActionSequencer) Start(org.infinispan.factories.annotations.Start)

Example 27 with Start

use of org.infinispan.factories.annotations.Start in project infinispan by infinispan.

the class LocalCacheStatus method preStart.

// This must be invoked before GlobalStateManagerImpl.start
@Start(priority = 0)
public void preStart() {
    helper = new TopologyManagementHelper(gcr);
    actionSequencer = new ActionSequencer(nonBlockingExecutor, true, timeService);
    if (globalStateManager != null) {
        globalStateManager.registerStateProvider(this);
    }
}
Also used : ActionSequencer(org.infinispan.util.concurrent.ActionSequencer) Start(org.infinispan.factories.annotations.Start)

Example 28 with Start

use of org.infinispan.factories.annotations.Start in project infinispan by infinispan.

the class TransactionTable method start.

// Start before cache loader manager
@Start(priority = 9)
public void start() {
    this.clustered = configuration.clustering().cacheMode().isClustered();
    this.isPessimisticLocking = configuration.transaction().lockingMode() == LockingMode.PESSIMISTIC;
    final int concurrencyLevel = configuration.locking().concurrencyLevel();
    // use the IdentityEquivalence because some Transaction implementation does not have a stable hash code function
    // and it can cause some leaks in the concurrent map.
    localTransactions = new ConcurrentHashMap<>(concurrencyLevel, 0.75f, concurrencyLevel);
    globalToLocalTransactions = new ConcurrentHashMap<>(concurrencyLevel, 0.75f, concurrencyLevel);
    boolean transactional = configuration.transaction().transactionMode().isTransactional();
    if (clustered && transactional) {
        minTopologyRecalculationLock = new ReentrantLock();
        remoteTransactions = new ConcurrentHashMap<>(concurrencyLevel, 0.75f, concurrencyLevel);
        notifier.addListener(this);
        cacheManagerNotifier.addListener(this);
        completedTransactionsInfo = new CompletedTransactionsInfo();
        // Periodically run a task to cleanup the transaction table of completed transactions.
        long interval = configuration.transaction().reaperWakeUpInterval();
        timeoutExecutor.scheduleAtFixedRate(() -> completedTransactionsInfo.cleanupCompletedTransactions(), interval, interval, TimeUnit.MILLISECONDS);
        timeoutExecutor.scheduleAtFixedRate(this::cleanupTimedOutTransactions, interval, interval, TimeUnit.MILLISECONDS);
    }
    running = true;
}
Also used : ReentrantLock(java.util.concurrent.locks.ReentrantLock) Start(org.infinispan.factories.annotations.Start)

Example 29 with Start

use of org.infinispan.factories.annotations.Start in project infinispan by infinispan.

the class PreloadManager method doPreload.

private CompletionStage<Void> doPreload() {
    Publisher<MarshallableEntry<Object, Object>> publisher = persistenceManager.preloadPublisher();
    long start = timeService.time();
    final long maxEntries = getMaxEntries();
    final long flags = getFlagsForStateInsertion();
    AdvancedCache<?, ?> tmpCache = this.cache.wired().withStorageMediaType();
    DataConversion keyDataConversion = tmpCache.getKeyDataConversion();
    DataConversion valueDataConversion = tmpCache.getValueDataConversion();
    Transaction outerTransaction = suspendIfNeeded();
    try {
        return Flowable.fromPublisher(publisher).take(maxEntries).concatMapSingle(me -> preloadEntry(flags, me, keyDataConversion, valueDataConversion)).count().toCompletionStage().thenAccept(insertAmount -> {
            this.fullyPreloaded = insertAmount < maxEntries;
            log.debugf("Preloaded %d keys in %s", insertAmount, Util.prettyPrintTime(timeService.timeDuration(start, MILLISECONDS)));
        });
    } finally {
        resumeIfNeeded(outerTransaction);
    }
}
Also used : DataConversion(org.infinispan.encoding.DataConversion) Single(io.reactivex.rxjava3.core.Single) LogFactory(org.infinispan.util.logging.LogFactory) InvocationHelper(org.infinispan.cache.impl.InvocationHelper) CompletionStages(org.infinispan.util.concurrent.CompletionStages) EnumUtil(org.infinispan.commons.util.EnumUtil) Start(org.infinispan.factories.annotations.Start) FlagBitSets(org.infinispan.context.impl.FlagBitSets) Scopes(org.infinispan.factories.scopes.Scopes) InternalMetadataImpl(org.infinispan.metadata.impl.InternalMetadataImpl) StoreConfiguration(org.infinispan.configuration.cache.StoreConfiguration) InvocationContext(org.infinispan.context.InvocationContext) LocalTxInvocationContext(org.infinispan.context.impl.LocalTxInvocationContext) ComponentRef(org.infinispan.factories.impl.ComponentRef) AdvancedCache(org.infinispan.AdvancedCache) KeyPartitioner(org.infinispan.distribution.ch.KeyPartitioner) Log(org.infinispan.util.logging.Log) MarshallableEntry(org.infinispan.persistence.spi.MarshallableEntry) Scope(org.infinispan.factories.scopes.Scope) InvocationContextFactory(org.infinispan.context.InvocationContextFactory) Transaction(javax.transaction.Transaction) CommandsFactory(org.infinispan.commands.CommandsFactory) Flowable(io.reactivex.rxjava3.core.Flowable) MethodHandles(java.lang.invoke.MethodHandles) Publisher(org.reactivestreams.Publisher) Util(org.infinispan.commons.util.Util) Completable(io.reactivex.rxjava3.core.Completable) MILLISECONDS(java.util.concurrent.TimeUnit.MILLISECONDS) Inject(org.infinispan.factories.annotations.Inject) CompletionStage(java.util.concurrent.CompletionStage) LocalTransaction(org.infinispan.transaction.impl.LocalTransaction) TransactionCoordinator(org.infinispan.transaction.impl.TransactionCoordinator) PutKeyValueCommand(org.infinispan.commands.write.PutKeyValueCommand) Configuration(org.infinispan.configuration.cache.Configuration) DataConversion(org.infinispan.encoding.DataConversion) TransactionManager(javax.transaction.TransactionManager) FakeJTATransaction(org.infinispan.transaction.impl.FakeJTATransaction) TransactionTable(org.infinispan.transaction.impl.TransactionTable) TimeService(org.infinispan.commons.time.TimeService) PersistenceException(org.infinispan.persistence.spi.PersistenceException) Transaction(javax.transaction.Transaction) LocalTransaction(org.infinispan.transaction.impl.LocalTransaction) FakeJTATransaction(org.infinispan.transaction.impl.FakeJTATransaction) MarshallableEntry(org.infinispan.persistence.spi.MarshallableEntry)

Example 30 with Start

use of org.infinispan.factories.annotations.Start in project infinispan by infinispan.

the class ScriptingManagerImpl method start.

@Start
public void start() {
    ClassLoader classLoader = globalConfiguration.classLoader();
    this.scriptEngineManager = new ScriptEngineManager(classLoader);
    taskManager.registerTaskEngine(new ScriptingTaskEngine(this));
    scriptConversions = new ScriptConversions(encoderRegistry);
}
Also used : ScriptConversions(org.infinispan.scripting.utils.ScriptConversions) ScriptEngineManager(javax.script.ScriptEngineManager) Start(org.infinispan.factories.annotations.Start)

Aggregations

Start (org.infinispan.factories.annotations.Start)31 Configuration (org.infinispan.configuration.cache.Configuration)7 Inject (org.infinispan.factories.annotations.Inject)7 Scope (org.infinispan.factories.scopes.Scope)7 Scopes (org.infinispan.factories.scopes.Scopes)7 Log (org.infinispan.util.logging.Log)7 LogFactory (org.infinispan.util.logging.LogFactory)7 CompletionStage (java.util.concurrent.CompletionStage)6 TimeService (org.infinispan.commons.time.TimeService)6 HashSet (java.util.HashSet)5 List (java.util.List)5 Transaction (javax.transaction.Transaction)5 CommandsFactory (org.infinispan.commands.CommandsFactory)5 PutKeyValueCommand (org.infinispan.commands.write.PutKeyValueCommand)5 GlobalConfiguration (org.infinispan.configuration.global.GlobalConfiguration)5 InvocationContext (org.infinispan.context.InvocationContext)5 FlagBitSets (org.infinispan.context.impl.FlagBitSets)5 KeyPartitioner (org.infinispan.distribution.ch.KeyPartitioner)5 ComponentRef (org.infinispan.factories.impl.ComponentRef)5 Transport (org.infinispan.remoting.transport.Transport)5