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


Java Flag类代码示例

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


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

示例1: assign

import org.infinispan.context.Flag; //导入依赖的package包/类
@Override
public XCourseRequest assign(XCourseRequest request, XEnrollment enrollment) {
	iLog.info("Assign " + request + " with " + enrollment);
	if (!isMaster())
		iLog.warn("Assigning a request on a slave node. That is suspicious.");
	Lock lock = writeLock();
	try {
		XStudent student = iStudentTable.get(request.getStudentId());
		for (XRequest r: student.getRequests()) {
			if (r.equals(request)) {
				XCourseRequest cr = (XCourseRequest)r;

				// assign
				cr.setEnrollment(enrollment);
				
				iStudentTable.getAdvancedCache().withFlags(Flag.IGNORE_RETURN_VALUES).put(student.getStudentId(), student);
				return cr;
			}
		}
		iLog.warn("ASSIGN[3]: Request " + student + " " + request + " was not found among student requests");
		return null;
	} finally {
		lock.release();
	}
}
 
开发者ID:UniTime,项目名称:unitime,代码行数:26,代码来源:ReplicatedServerWithMaster.java

示例2: remove

import org.infinispan.context.Flag; //导入依赖的package包/类
@Override
public void remove(XStudent student) {
	Lock lock = writeLock();
	try {
		XStudent oldStudent = iStudentTable.remove(student.getStudentId());
		if (oldStudent != null) {
			for (XRequest request: oldStudent.getRequests())
				if (request instanceof XCourseRequest)
					for (XCourseId course: ((XCourseRequest)request).getCourseIds()) {
						Set<XCourseRequest> requests = iOfferingRequests.get(course.getOfferingId());
						if (requests != null) {
							if (!requests.remove(request))
								iLog.warn("REMOVE[1]: Request " + student + " " + request + " was not present in the offering requests table for " + course);
							iOfferingRequests.getAdvancedCache().withFlags(Flag.IGNORE_RETURN_VALUES).put(course.getOfferingId(), requests);
						} else {
							iLog.warn("REMOVE[2]: Request " + student + " " + request + " was not present in the offering requests table for " + course);
						}
					}
		}
	} finally {
		lock.release();
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:24,代码来源:ReplicatedServer.java

示例3: main

import org.infinispan.context.Flag; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
   // Setup up a clustered cache manager
   GlobalConfigurationBuilder global = GlobalConfigurationBuilder.defaultClusteredBuilder();
   // Make the default cache a replicated synchronous one
   ConfigurationBuilder builder = new ConfigurationBuilder();
   builder.clustering().cacheMode(CacheMode.REPL_SYNC);
   // Initialize the cache manager
   DefaultCacheManager cacheManager = new DefaultCacheManager(global.build(), builder.build());
   // Obtain the default cache
   Cache<String, String> cache = cacheManager.getCache();
   // Store the current node address in some random keys
   for(int i=0; i < 10; i++) {
      cache.put(UUID.randomUUID().toString(), cacheManager.getNodeAddress());
   }
   // Display the current cache contents for the whole cluster
   cache.entrySet().forEach(entry -> System.out.printf("%s = %s\n", entry.getKey(), entry.getValue()));
   // Display the current cache contents for this node
   cache.getAdvancedCache().withFlags(Flag.SKIP_REMOTE_LOOKUP)
      .entrySet().forEach(entry -> System.out.printf("%s = %s\n", entry.getKey(), entry.getValue()));
   // Stop the cache manager and release all resources
   cacheManager.stop();
}
 
开发者ID:infinispan,项目名称:infinispan-simple-tutorials,代码行数:23,代码来源:InfinispanReplicated.java

示例4: main

import org.infinispan.context.Flag; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
   // Setup up a clustered cache manager
   GlobalConfigurationBuilder global = GlobalConfigurationBuilder.defaultClusteredBuilder();
   // Make the default cache a distributed synchronous one
   ConfigurationBuilder builder = new ConfigurationBuilder();
   builder.clustering().cacheMode(CacheMode.DIST_SYNC);
   // Initialize the cache manager
   DefaultCacheManager cacheManager = new DefaultCacheManager(global.build(), builder.build());
   // Obtain the default cache
   Cache<String, String> cache = cacheManager.getCache();
   // Store the current node address in some random keys
   for(int i=0; i < 10; i++) {
      cache.put(UUID.randomUUID().toString(), cacheManager.getNodeAddress());
   }
   // Display the current cache contents for the whole cluster
   cache.entrySet().forEach(entry -> System.out.printf("%s = %s\n", entry.getKey(), entry.getValue()));
   // Display the current cache contents for this node
   cache.getAdvancedCache().withFlags(Flag.SKIP_REMOTE_LOOKUP)
      .entrySet().forEach(entry -> System.out.printf("%s = %s\n", entry.getKey(), entry.getValue()));
   // Stop the cache manager and release all resources
   cacheManager.stop();
}
 
开发者ID:infinispan,项目名称:infinispan-simple-tutorials,代码行数:23,代码来源:InfinispanDistributed.java

示例5: getNodeCache

import org.infinispan.context.Flag; //导入依赖的package包/类
/**
 * Return the node id -> node cache from the cache manager. This cache is heavily used to lookup
 * nodes when querying or loading triples and should therefore have a decent size (default 500.000 elements).
 *
 * @return an EHCache Cache instance containing the node id -> node mappings
 */
public Map getNodeCache() {
    if(nodeCache == null) {
        Configuration nodeConfiguration = new ConfigurationBuilder().read(defaultConfiguration)
                .eviction()
                    .maxEntries(1000000)
                .expiration()
                    .lifespan(60, TimeUnit.MINUTES)
                    .maxIdle(30, TimeUnit.MINUTES)
                .build();
        cacheManager.defineConfiguration(NODE_CACHE, nodeConfiguration);

        nodeCache = new AsyncMap(cacheManager.getCache(NODE_CACHE).getAdvancedCache().withFlags(Flag.SKIP_LOCKING, Flag.SKIP_CACHE_LOAD, Flag.SKIP_REMOTE_LOOKUP));
    }

    return nodeCache;
}
 
开发者ID:apache,项目名称:marmotta,代码行数:23,代码来源:InfinispanEmbeddedCacheManager.java

示例6: getTripleCache

import org.infinispan.context.Flag; //导入依赖的package包/类
/**
 * Return the triple id -> triple cache from the cache manager. This cache is used for speeding up the
 * construction of query results.
 *
 * @return
 */
public Map getTripleCache() {
    if(tripleCache == null) {
        Configuration tripleConfiguration = new ConfigurationBuilder().read(defaultConfiguration)
                .clustering()
                    .cacheMode(CacheMode.LOCAL)
                .eviction()
                    .maxEntries(config.getTripleCacheSize())
                .expiration()
                    .lifespan(60, TimeUnit.MINUTES)
                    .maxIdle(30, TimeUnit.MINUTES)
                .build();
        cacheManager.defineConfiguration(TRIPLE_CACHE, tripleConfiguration);

        tripleCache = new AsyncMap(cacheManager.getCache(TRIPLE_CACHE).getAdvancedCache().withFlags(Flag.SKIP_LOCKING, Flag.SKIP_CACHE_LOAD, Flag.SKIP_REMOTE_LOOKUP));
    }
    return tripleCache;
}
 
开发者ID:apache,项目名称:marmotta,代码行数:24,代码来源:InfinispanEmbeddedCacheManager.java

示例7: callFunctionPut

import org.infinispan.context.Flag; //导入依赖的package包/类
/**
 * HTTP POST request accepted, issued on service/cacheName_put?params...&$filter=... URI
 *
 * @return
 */
private BaseResponse callFunctionPut(String setNameWhichIsCacheName, String entryKey, CachedValue cachedValue,
                                     boolean ignoreReturnValues) {

    log.trace("Putting into " + setNameWhichIsCacheName + " cache, entryKey: " +
            entryKey + " value: " + cachedValue.toString() + " ignoreReturnValues=" + ignoreReturnValues);

    if (ignoreReturnValues) {
        getCache(setNameWhichIsCacheName).withFlags(Flag.IGNORE_RETURN_VALUES).put(entryKey, cachedValue);
        return Responses.infinispanResponse(null, null, null, Response.Status.CREATED);
    } else {
        getCache(setNameWhichIsCacheName).put(entryKey, cachedValue);
        CachedValue resultOfPutForResponse = (CachedValue) getCache(setNameWhichIsCacheName).get(entryKey);
        return Responses.infinispanResponse(EdmSimpleType.STRING, "jsonValue", standardizeJSONresponse(
                new StringBuilder(resultOfPutForResponse.getJsonValueWrapper().getJson())).toString(), Response.Status.CREATED);
    }
}
 
开发者ID:tsykora,项目名称:infinispan-odata-server,代码行数:22,代码来源:InfinispanProducer.java

示例8: main

import org.infinispan.context.Flag; //导入依赖的package包/类
public static void main(String[] args) throws IOException, InterruptedException {
	
      //Configuration
	ConfigurationBuilder builder = new ConfigurationBuilder();
	builder
		.eviction()
		.strategy(EvictionStrategy.LRU)
		.type(EvictionType.COUNT)
		.size(3)
		;
      // Initialize the cache manager
	DefaultCacheManager cacheManager = new DefaultCacheManager(builder.build());
    // Obtain the default cache
    Cache<Long, MoneyTransfert> cache = cacheManager.getCache("beosbank-dist");
      
	// Obtain the remote cache
	cache.addListener(new DatagridListener());
	// Create a Money Transfer Object from XML Message using BeaoIO API
	try {
		BeosBankCacheUtils.loadEntries(cache,inputFileNames);

		// Inspect the cache .
		System.out.println(cache.size());
		System.out.println(cache.get(3l));
		
		//Current node content
		cache.getAdvancedCache().withFlags(Flag.SKIP_REMOTE_LOOKUP)
        .entrySet().forEach(entry -> System.out.printf("%s = %s\n", entry.getKey(), entry.getValue().getDescription()));
		
		// Stop the cache
		cache.stop();

	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

}
 
开发者ID:PacktPublishing,项目名称:JBoss-Developers-Guide,代码行数:39,代码来源:EvictionDemo.java

示例9: update

import org.infinispan.context.Flag; //导入依赖的package包/类
@Override
public void update(XExpectations expectations) {
	if (!isMaster())
		iLog.warn("Updating expectations on a slave node. That is suspicious.");
	Lock lock = writeLock();
	try {
		iExpectations.getAdvancedCache().withFlags(Flag.IGNORE_RETURN_VALUES).put(expectations.getOfferingId(), expectations);
	} finally {
		lock.release();
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:12,代码来源:ReplicatedServerWithMaster.java

示例10: remove

import org.infinispan.context.Flag; //导入依赖的package包/类
@Override
public void remove(XStudent student) {
	if (!isMaster())
		iLog.warn("Removing student on a slave node. That is suspicious.");
	Lock lock = writeLock();
	try {
		iStudentTable.getAdvancedCache().withFlags(Flag.IGNORE_RETURN_VALUES).remove(student.getStudentId());
	} finally {
		lock.release();
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:12,代码来源:ReplicatedServerWithMaster.java

示例11: setProperty

import org.infinispan.context.Flag; //导入依赖的package包/类
@Override
public <E> void setProperty(String name, E value) {
	Cache<String, Object> properties = (Cache<String, Object>)iProperties;
	if (value == null)
		properties.getAdvancedCache().withFlags(Flag.FORCE_SYNCHRONOUS, Flag.IGNORE_RETURN_VALUES).remove(name);
	else
		properties.getAdvancedCache().withFlags(Flag.FORCE_SYNCHRONOUS, Flag.IGNORE_RETURN_VALUES).put(name,  value);
	flushCache(properties);
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:10,代码来源:ReplicatedServerWithMaster.java

示例12: update

import org.infinispan.context.Flag; //导入依赖的package包/类
@Override
public void update(XExpectations expectations) {
	Lock lock = writeLock();
	try {
		iExpectations.getAdvancedCache().withFlags(Flag.IGNORE_RETURN_VALUES).put(expectations.getOfferingId(), expectations);
	} finally {
		lock.release();
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:10,代码来源:ReplicatedServer.java

示例13: put

import org.infinispan.context.Flag; //导入依赖的package包/类
@Override
public void put(K k, V v, Handler<AsyncResult<Void>> completionHandler) {
  Object kk = DataConverter.toCachedObject(k);
  Object vv = DataConverter.toCachedObject(v);
  Future<Object> vertxFuture = Future.future();
  vertxFuture.map((Void) null).setHandler(completionHandler);
  whenComplete(cache.withFlags(Flag.IGNORE_RETURN_VALUES).putAsync(kk, vv), vertxFuture);
}
 
开发者ID:vert-x3,项目名称:vertx-infinispan,代码行数:9,代码来源:InfinispanAsyncMapImpl.java

示例14: ignoreReturnValuesCache

import org.infinispan.context.Flag; //导入依赖的package包/类
public static <K, V> BasicCache<K, V> ignoreReturnValuesCache(BasicCache<K, V> cache) {
    if (isEmbedded(cache)) {
        return ((Cache<K, V>) cache).getAdvancedCache().withFlags(Flag.IGNORE_RETURN_VALUES);
    } else {
        return cache;
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:InfinispanUtil.java

示例15: setFlags

import org.infinispan.context.Flag; //导入依赖的package包/类
/**
 * A comma separated list of Flag to be applied by default on each cache
 * invocation, not applicable to remote caches.
 */
public void setFlags(String flagsAsString) {
    String[] flagsArray = flagsAsString.split(",");
    this.flags = new Flag[flagsArray.length];

    for (int i = 0; i < flagsArray.length; i++) {
        this.flags[i] = Flag.valueOf(flagsArray[i]);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:13,代码来源:InfinispanConfiguration.java


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