当前位置: 首页>>代码示例>>Java>>正文


Java EmbeddedCacheManager类代码示例

本文整理汇总了Java中org.infinispan.manager.EmbeddedCacheManager的典型用法代码示例。如果您正苦于以下问题:Java EmbeddedCacheManager类的具体用法?Java EmbeddedCacheManager怎么用?Java EmbeddedCacheManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EmbeddedCacheManager类属于org.infinispan.manager包,在下文中一共展示了EmbeddedCacheManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createCacheManager

import org.infinispan.manager.EmbeddedCacheManager; //导入依赖的package包/类
@Bean(destroyMethod = "stop")
public EmbeddedCacheManager createCacheManager() {
    GlobalConfigurationBuilder globalCfg = new GlobalConfigurationBuilder();
    globalCfg.globalJmxStatistics().allowDuplicateDomains(true).disable(); // get rid of this?

    ConfigurationBuilder cacheCfg = new ConfigurationBuilder();
    cacheCfg.jmxStatistics().disable();
    cacheCfg.indexing()
        .index(Index.ALL)
        .addIndexedEntity(Fruit.class)
        .addIndexedEntity(CEntity.class)
        .addIndexedEntity(SimpleEntity.class)
        .addProperty("default.directory_provider", "local-heap")
        .addProperty("lucene_version", "LUCENE_CURRENT");

    return new DefaultCacheManager(globalCfg.build(), cacheCfg.build());
}
 
开发者ID:snowdrop,项目名称:spring-data-snowdrop,代码行数:18,代码来源:InfinispanConfiguration.java

示例2: releaseMasterLockIfHeld

import org.infinispan.manager.EmbeddedCacheManager; //导入依赖的package包/类
@Override
public void releaseMasterLockIfHeld() {
	if (iMasterThread != null) {
		iMasterThread.release();
	} else if (Boolean.TRUE.equals(getProperty("ReloadIsNeeded", Boolean.FALSE))) {
		iLog.info("Reloading server...");
		final Long sessionId = getAcademicSession().getUniqueId();
		loadOnMaster(new OnlineSectioningServerContext() {
			@Override
			public Long getAcademicSessionId() { return sessionId; }
			@Override
			public boolean isWaitTillStarted() { return false; }
			@Override
			public EmbeddedCacheManager getCacheManager() { return null; }
			@Override
			public LockService getLockService() { return null; }
		});
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:20,代码来源:AbstractServer.java

示例3: getServerContext

import org.infinispan.manager.EmbeddedCacheManager; //导入依赖的package包/类
@Override
   public OnlineSectioningServerContext getServerContext(final Long academicSessionId) {
	return new OnlineSectioningServerContext() {
		@Override
		public Long getAcademicSessionId() {
			return academicSessionId;
		}

		@Override
		public boolean isWaitTillStarted() {
			return false;
		}

		@Override
		public EmbeddedCacheManager getCacheManager() {
			return OnlineStudentSchedulingContainerRemote.this.getCacheManager();
		}

		@Override
		public LockService getLockService() {
			return iLockService;
		}
	};
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:25,代码来源:OnlineStudentSchedulingContainerRemote.java

示例4: getServerContext

import org.infinispan.manager.EmbeddedCacheManager; //导入依赖的package包/类
public OnlineSectioningServerContext getServerContext(final Long academicSessionId) {
	return new OnlineSectioningServerContext() {
		@Override
		public Long getAcademicSessionId() {
			return academicSessionId;
		}

		@Override
		public boolean isWaitTillStarted() {
			return false;
		}

		@Override
		public EmbeddedCacheManager getCacheManager() {
			return null;
		}

		@Override
		public LockService getLockService() {
			return null;
		}
	};
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:24,代码来源:OnlineStudentSchedulingContainer.java

示例5: defaultClusteredCacheManager

import org.infinispan.manager.EmbeddedCacheManager; //导入依赖的package包/类
@Produces
@ApplicationScoped
public EmbeddedCacheManager defaultClusteredCacheManager() {
    GlobalConfiguration g = new GlobalConfigurationBuilder()
            .clusteredDefault()
            .transport()
            .clusterName(MACHINE_TRANSLATIONS_CLUSTER)
            .globalJmxStatistics()
            .allowDuplicateDomains(true)
            .build();
    Configuration cfg = new ConfigurationBuilder()
            .clustering()
            .cacheMode(CacheMode.DIST_ASYNC)
            .eviction()
            .strategy(EvictionStrategy.LRU)
            .type(EvictionType.COUNT).size(150)
            .transaction()
            .transactionMode(TransactionMode.TRANSACTIONAL)
            .lockingMode(LockingMode.PESSIMISTIC)
            .build();
    return new DefaultCacheManager(g, cfg);
}
 
开发者ID:zanata,项目名称:zanata-mt,代码行数:23,代码来源:ResourceProducer.java

示例6: testStart

import org.infinispan.manager.EmbeddedCacheManager; //导入依赖的package包/类
/**
 * Run multiple instances and check that all instances are online.
 * 
 * @throws ExecutionException 
 * @throws TimeoutException 
 */
@Test
public void testStart() throws IOException, InterruptedException, ExecutionException {
	int nodeNumber = 3;
	prepareCluster(nodeNumber, null);
	
	// start test instance
	EmbeddedCacheManager cacheManager = new TestCacheManagerBuilder("node main", null).build();
	this.cacheManager = cacheManager;
	cacheManager.start();
	
	LOGGER.debug("waiting nodes");
	try {
		waitNodes(cacheManager, nodeNumber + 1, 30, TimeUnit.SECONDS);
	} catch (TimeoutException e) {
		Assert.fail(String.format("Node number %d not reached before timeout", nodeNumber + 1));
	}
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:24,代码来源:TestSimpleCluster.java

示例7: run

import org.infinispan.manager.EmbeddedCacheManager; //导入依赖的package包/类
@Override
public void run() {
	final EmbeddedCacheManager cacheManager = new TestCacheManagerBuilder(nodeName, taskName).build();
	cacheManager.start();
	
	while (!Thread.currentThread().isInterrupted()) {
		try {
			Object object = new Object();
			// synchronized to become object owner
			LOGGER.debug("Start main loop");
			synchronized (object) {
				object.wait();
			}
		} catch (InterruptedException e) {
			LOGGER.warn("Thread interrupted while wait");
			Thread.currentThread().interrupt();
		}
	}
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:20,代码来源:SimpleProcess.java

示例8: run

import org.infinispan.manager.EmbeddedCacheManager; //导入依赖的package包/类
@Override
public void run() {
	final EmbeddedCacheManager cacheManager = new TestCacheManagerBuilder(nodeName, taskName).build();
	InfinispanClusterServiceImpl cluster =
			new InfinispanClusterServiceImpl(nodeName, cacheManager, new SimpleRolesProvider(), null, null);
	cluster.init();
	
	while (!Thread.currentThread().isInterrupted()) {
		try {
			Object object = new Object();
			// synchronized to become object owner
			LOGGER.debug("Start main loop");
			synchronized (object) {
				object.wait();
			}
		} catch (InterruptedException e) {
			LOGGER.warn("Thread interrupted while wait");
			Thread.currentThread().interrupt();
		}
	}
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:22,代码来源:InfinispanClusterProcess.java

示例9: infinispanClusterService

import org.infinispan.manager.EmbeddedCacheManager; //导入依赖的package包/类
@Bean(destroyMethod = "stop")
public IInfinispanClusterService infinispanClusterService(IPropertyService propertyService, IRolesProvider rolesProvider,
		IActionFactory springActionFactory, IInfinispanClusterCheckerService infinispanClusterCheckerService,
		EntityManagerFactory entityManagerFactory) {
	if (propertyService.get(JpaMoreInfinispanPropertyIds.INFINISPAN_ENABLED)) {
		String nodeName = propertyService.get(JpaMoreInfinispanPropertyIds.INFINISPAN_NODE_NAME);
		Properties properties = new Properties();
		for (String key : propertyService.get(JpaMoreInfinispanPropertyIds.INFINISPAN_TRANSPORT_PROPERTIES)) {
			properties.put(key, propertyService.getAsString(JpaMoreInfinispanPropertyIds.transportProperty(key)));
		}
		GlobalConfiguration globalConfiguration =
				new GlobalDefaultReplicatedTransientConfigurationBuilder(properties).nodeName(nodeName).build();
		org.infinispan.configuration.cache.Configuration configuration =
				new DefaultReplicatedTransientConfigurationBuilder().build();
		EmbeddedCacheManager cacheManager = new DefaultCacheManager(globalConfiguration, configuration, false);
		
		InfinispanClusterServiceImpl cluster =
				new InfinispanClusterServiceImpl(nodeName, cacheManager, rolesProvider, springActionFactory,
						infinispanClusterCheckerService);
		cluster.init();
		return cluster;
	} else {
		return null;
	}
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:26,代码来源:JpaMoreInfinispanConfig.java

示例10: createCacheManager

import org.infinispan.manager.EmbeddedCacheManager; //导入依赖的package包/类
@Override
protected EmbeddedCacheManager createCacheManager() throws Exception {
   ConfigurationBuilder cfg = getDefaultStandaloneCacheConfig(false);
   cfg.indexing().enable()
         .addProperty("default.directory_provider", "ram")
         .addProperty("lucene_version", "LUCENE_CURRENT");
   cfg.validate();
   
   Configuration configuration = cfg.build();
   assert cfg.clustering().cacheMode() == CacheMode.LOCAL;
   
   EmbeddedCacheManager cacheManager = new DefaultCacheManager(configuration);
   cacheManager.getCache();

   return cacheManager;
}
 
开发者ID:leads-project,项目名称:infinispan-avro,代码行数:17,代码来源:AvroWrapperIndexingTest.java

示例11: doCreateHttpServerMechanismFactory

import org.infinispan.manager.EmbeddedCacheManager; //导入依赖的package包/类
@Override
protected HttpServerAuthenticationMechanismFactory doCreateHttpServerMechanismFactory(Map<String, ?> properties) {
    HttpServerAuthenticationMechanismFactory delegate = super.doCreateHttpServerMechanismFactory(properties);

    String cacheManagerName = UUID.randomUUID().toString();
    EmbeddedCacheManager cacheManager = new DefaultCacheManager(
            GlobalConfigurationBuilder.defaultClusteredBuilder()
                    .globalJmxStatistics().cacheManagerName(cacheManagerName)
                    .transport().nodeName(cacheManagerName).addProperty(JGroupsTransport.CONFIGURATION_FILE, "fast.xml")
                    .build(),
            new ConfigurationBuilder()
                    .clustering()
                    .cacheMode(CacheMode.REPL_SYNC)
                    .build()
    );

    Cache<String, SingleSignOnEntry> cache = cacheManager.getCache();
    SingleSignOnManager manager = new DefaultSingleSignOnManager(cache, new DefaultSingleSignOnSessionIdentifierFactory(), (id, entry) -> cache.put(id, entry));
    SingleSignOnServerMechanismFactory.SingleSignOnConfiguration signOnConfiguration = new SingleSignOnServerMechanismFactory.SingleSignOnConfiguration("JSESSIONSSOID", null, "/", false, false);

    SingleSignOnSessionFactory singleSignOnSessionFactory = new DefaultSingleSignOnSessionFactory(manager, this.keyPairSupplier.get());

    return new SingleSignOnServerMechanismFactory(delegate, singleSignOnSessionFactory, signOnConfiguration);
}
 
开发者ID:wildfly-security,项目名称:elytron-web,代码行数:25,代码来源:FormAuthenticationWithClusteredSSOTest.java

示例12: createLocalCacheViaJNDI

import org.infinispan.manager.EmbeddedCacheManager; //导入依赖的package包/类
private CacheContainerWrapper createLocalCacheViaJNDI()
		throws ResourceException {

	String jndiName = getCacheJndiName();
	try {
		final Object cache = performJNDICacheLookup(jndiName);

		LogManager
				.logDetail(
						LogConstants.CTX_CONNECTOR,
						"=== Using CacheContainer (obtained by JNDI:", jndiName, "==="); //$NON-NLS-1 //$NON-NLS-2 		

		return new LocalCacheWrapper((EmbeddedCacheManager) cache);

	} catch (ResourceException re) {
		throw re;
	} catch (Exception err) {
		if (err instanceof RuntimeException)
			throw (RuntimeException) err;
		throw new ResourceException(err);
	}

}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:24,代码来源:AbstractInfinispanManagedConnectionFactory.java

示例13: initCacheInfinispan

import org.infinispan.manager.EmbeddedCacheManager; //导入依赖的package包/类
/**
 * Inits the cache infinispan.
 */
private static void initCacheInfinispan() {
	EmbeddedCacheManager manager = new DefaultCacheManager();
	Configuration config = new Configuration().fluent()
	  .eviction()
	    .maxEntries((int)sCacheItemsLimit).strategy(EvictionStrategy.LRU)
	    /*.wakeUpInterval(5000L)*/ // TODO - fix it 
	  .expiration()
	    .maxIdle(120000L)
	    .build();

	manager.defineConfiguration("name", config);
	ispnCache = manager.getCache("name");


}
 
开发者ID:VladRodionov,项目名称:bigbase,代码行数:19,代码来源:PerfTest.java

示例14: create

import org.infinispan.manager.EmbeddedCacheManager; //导入依赖的package包/类
@Override
public BenchmarkCache<Integer, Integer> create(int _maxElements) {
  EmbeddedCacheManager m = getCacheMangaer();
  ConfigurationBuilder cb = new ConfigurationBuilder();

  cb.eviction().maxEntries(_maxElements);
  cb.storeAsBinary().disable();
  if (!withExpiry) {
    cb.expiration().disableReaper().lifespan(-1);
  } else {
    cb.expiration().lifespan(5 * 60, TimeUnit.SECONDS);
  }
  switch (algorithm) {
    case LRU: cb.eviction().strategy(EvictionStrategy.LRU); break;
    case LIRS: cb.eviction().strategy(EvictionStrategy.LIRS); break;
    case UNORDERED: cb.eviction().strategy(EvictionStrategy.UNORDERED); break;
  }
  m.defineConfiguration(CACHE_NAME, cb.build());
  Cache<Integer, Integer> _cache = m.getCache(CACHE_NAME);
  return new MyBenchmarkCache(_cache);
}
 
开发者ID:cache2k,项目名称:cache2k-benchmark,代码行数:22,代码来源:InfinispanCacheFactory.java

示例15: testConfigBuilder

import org.infinispan.manager.EmbeddedCacheManager; //导入依赖的package包/类
public void testConfigBuilder() {
   GlobalConfiguration globalConfig = new GlobalConfigurationBuilder().globalJmxStatistics().transport().defaultTransport().build();

   Configuration cacheConfig = new ConfigurationBuilder().persistence().addStore(LevelDBStoreConfigurationBuilder.class).location(tmpDataDirectory)
         .expiredLocation(tmpExpiredDirectory).implementationType(LevelDBStoreConfiguration.ImplementationType.AUTO).build();

   StoreConfiguration cacheLoaderConfig = cacheConfig.persistence().stores().get(0);
   assertTrue(cacheLoaderConfig instanceof LevelDBStoreConfiguration);
   LevelDBStoreConfiguration leveldbConfig = (LevelDBStoreConfiguration) cacheLoaderConfig;
   assertEquals(tmpDataDirectory, leveldbConfig.location());
   assertEquals(tmpExpiredDirectory, leveldbConfig.expiredLocation());

   EmbeddedCacheManager cacheManager = new DefaultCacheManager(globalConfig);

   cacheManager.defineConfiguration("testCache", cacheConfig);

   cacheManager.start();
   Cache<String, String> cache = cacheManager.getCache("testCache");

   cache.put("hello", "there");
   cache.stop();
   cacheManager.stop();
}
 
开发者ID:danberindei,项目名称:infinispan-cachestore-leveldb,代码行数:24,代码来源:ConfigurationTest.java


注:本文中的org.infinispan.manager.EmbeddedCacheManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。