Search in sources :

Example 6 with Start

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

the class AbstractMetricsRegistration method start.

@Start
protected void start() {
    if (metricsEnabled()) {
        namePrefix = initNamePrefix();
        metricIds = Collections.synchronizedSet(new HashSet<>());
        try {
            processComponents();
        } catch (Exception e) {
            throw new CacheException("A failure occurred while registering metrics.", e);
        }
    }
}
Also used : CacheException(org.infinispan.commons.CacheException) CacheException(org.infinispan.commons.CacheException) HashSet(java.util.HashSet) Start(org.infinispan.factories.annotations.Start)

Example 7 with Start

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

the class SerializationContextRegistryImpl method start.

@Start
public void start() {
    user.addContextInitializer(new CommonTypesSchema());
    user.addContextInitializer(new CommonContainerTypesSchema());
    user.addContextInitializer(new UserContextInitializerImpl());
    // Add user configured SCIs
    Collection<SerializationContextInitializer> initializers = globalConfig.serialization().contextInitializers();
    if (initializers == null || initializers.isEmpty()) {
        // If no SCIs have been explicitly configured, then load all available SCI services
        initializers = ServiceFinder.load(SerializationContextInitializer.class, globalConfig.classLoader());
    }
    initializers.forEach(user::addContextInitializer);
    String messageName = PersistenceContextInitializer.getFqTypeName(MarshallableUserObject.class);
    BaseMarshaller userObjectMarshaller = new MarshallableUserObject.Marshaller(messageName, userMarshaller.wired());
    update(GLOBAL, ctx -> ctx.addContextInitializer(new PersistenceContextInitializerImpl()).addContextInitializer(new org.infinispan.commons.GlobalContextInitializerImpl()).addMarshaller(userObjectMarshaller));
    update(PERSISTENCE, ctx -> ctx.addContextInitializer(new PersistenceContextInitializerImpl()).addMarshaller(userObjectMarshaller));
}
Also used : CommonTypesSchema(org.infinispan.protostream.types.java.CommonTypesSchema) BaseMarshaller(org.infinispan.protostream.BaseMarshaller) Marshaller(org.infinispan.commons.marshall.Marshaller) UserContextInitializerImpl(org.infinispan.commons.marshall.UserContextInitializerImpl) SerializationContextInitializer(org.infinispan.protostream.SerializationContextInitializer) CommonContainerTypesSchema(org.infinispan.protostream.types.java.CommonContainerTypesSchema) PersistenceContextInitializerImpl(org.infinispan.marshall.persistence.impl.PersistenceContextInitializerImpl) BaseMarshaller(org.infinispan.protostream.BaseMarshaller) Start(org.infinispan.factories.annotations.Start)

Example 8 with Start

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

the class DefaultIracTombstoneManager method start.

@Start
public void start() {
    Transport transport = rpcManager.getTransport();
    transport.checkCrossSiteAvailable();
    String localSiteName = transport.localSiteName();
    asyncBackups.removeIf(xSiteBackup -> localSiteName.equals(xSiteBackup.getSiteName()));
    iracExecutor.setBackOff(ExponentialBackOff.NO_OP);
    iracExecutor.setExecutor(blockingExecutor);
    stopped = false;
    scheduler.disabled = false;
    scheduler.scheduleWithCurrentDelay();
}
Also used : Transport(org.infinispan.remoting.transport.Transport) Start(org.infinispan.factories.annotations.Start)

Example 9 with Start

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

the class DefaultConflictManager method start.

@Start
public void start() {
    this.localAddress = rpcManager.getAddress();
    PartitionHandlingConfiguration config = cacheConfiguration.clustering().partitionHandling();
    this.entryMergePolicy = mergePolicyRegistry.createInstance(config);
    // TODO make this an explicit configuration param in PartitionHandlingConfiguration
    this.conflictTimeout = cacheConfiguration.clustering().stateTransfer().timeout();
    // Limit the number of concurrent tasks to ensure that internal CR operations can never overlap
    this.resolutionExecutor = blockingManager.limitedBlockingExecutor("ConflictManager-" + cacheName, 1);
    this.running = true;
    if (log.isTraceEnabled())
        log.tracef("Cache %s starting %s. isRunning=%s", cacheName, getClass().getSimpleName(), !running);
}
Also used : PartitionHandlingConfiguration(org.infinispan.configuration.cache.PartitionHandlingConfiguration) Start(org.infinispan.factories.annotations.Start)

Example 10 with Start

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

the class ClusterPublisherManagerImpl method start.

@Start
public void start() {
    maxSegment = cacheConfiguration.clustering().hash().numSegments();
    writeBehindShared = hasWriteBehindSharedStore(cacheConfiguration.persistence());
    persistenceManager.addStoreListener(storeChangeListener);
    // Note we use a little extra wiggle room for the timeout of the remote invocation by increasing it by 3 times
    // normal. This is due to our responses requiring additional processing time (iteration serialization and normally
    // increased payloads)
    rpcOptions = new RpcOptions(DeliverOrder.NONE, cacheConfiguration.clustering().remoteTimeout() * 3, TimeUnit.MILLISECONDS);
    cacheConfiguration.clustering().attributes().attribute(ClusteringConfiguration.REMOTE_TIMEOUT).addListener((a, ignored) -> {
        rpcOptions = new RpcOptions(DeliverOrder.NONE, a.get() * 3, TimeUnit.MILLISECONDS);
    });
}
Also used : RpcOptions(org.infinispan.remoting.rpc.RpcOptions) 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