Java Code Examples for org.apache.ignite.configuration.CacheConfiguration#getEvictionPolicyFactory()

The following examples show how to use org.apache.ignite.configuration.CacheConfiguration#getEvictionPolicyFactory() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GridCacheEvictionManager.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override public void start0() throws IgniteCheckedException {
    CacheConfiguration cfg = cctx.config();

    if (cctx.isNear()) {
        plc = (cfg.getNearConfiguration().getNearEvictionPolicyFactory() != null) ?
            (EvictionPolicy)cfg.getNearConfiguration().getNearEvictionPolicyFactory().create() :
            cfg.getNearConfiguration().getNearEvictionPolicy();
    }
    else if (cfg.getEvictionPolicyFactory() != null)
        plc = (EvictionPolicy)cfg.getEvictionPolicyFactory().create();
    else
        plc = cfg.getEvictionPolicy();

    plcEnabled = plc != null;

    if (plcEnabled)
        prepare(cfg, plc, cctx.isNear());

    filter = cfg.getEvictionFilter();

    if (log.isDebugEnabled())
        log.debug("Eviction manager started on node: " + cctx.nodeId());
}
 
Example 2
Source File: IgfsHelperImpl.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void preProcessCacheConfiguration(CacheConfiguration cfg) {
    EvictionPolicy evictPlc = cfg.getEvictionPolicyFactory() != null ?
        (EvictionPolicy)cfg.getEvictionPolicyFactory().create()
        : cfg.getEvictionPolicy();

    if (evictPlc instanceof IgfsPerBlockLruEvictionPolicy && cfg.getEvictionFilter() == null)
        cfg.setEvictionFilter(new IgfsEvictionFilter());
}
 
Example 3
Source File: IgfsHelperImpl.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void validateCacheConfiguration(CacheConfiguration cfg) throws IgniteCheckedException {
    EvictionPolicy evictPlc = cfg.getEvictionPolicyFactory() != null ?
        (EvictionPolicy)cfg.getEvictionPolicyFactory().create()
        : cfg.getEvictionPolicy();

    if (evictPlc != null && evictPlc instanceof IgfsPerBlockLruEvictionPolicy) {
        EvictionFilter evictFilter = cfg.getEvictionFilter();

        if (evictFilter != null && !(evictFilter instanceof IgfsEvictionFilter))
            throw new IgniteCheckedException("Eviction filter cannot be set explicitly when using " +
                "IgfsPerBlockLruEvictionPolicy: " + U.maskName(cfg.getName()));
    }
}
 
Example 4
Source File: VisorCacheEvictionConfiguration.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * Create data transfer object for eviction configuration properties.
 * @param ccfg Cache configuration.
 */
public VisorCacheEvictionConfiguration(CacheConfiguration ccfg) {
    final Factory evictionPlc = ccfg.getEvictionPolicyFactory();

    plc = compactClass(evictionPlc);
    plcMaxSize = evictionPolicyMaxSize(evictionPlc);
    filter = compactClass(ccfg.getEvictionFilter());
}