ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [31/79] [abbrv] incubator-ignite git commit: # ignite-63
Date Fri, 23 Jan 2015 16:06:30 GMT
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheDataStructureInvalidException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheDataStructureInvalidException.java b/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheDataStructureInvalidException.java
deleted file mode 100644
index dfde5de..0000000
--- a/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheDataStructureInvalidException.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.cache.datastructures;
-
-import org.apache.ignite.*;
-import org.jetbrains.annotations.*;
-
-/**
- * This checked exception gets thrown if attempt to access an invalid data structure has been made.
- * Data structure may become invalid if communication with remote nodes has been lost or
- * any other error condition happened that prevented from insuring consistent state.
- * <p>
- * The best way to handle this error is to discard the invalid data structure instance and try
- * getting the underlying data structure from cache again.
- * <p>
- * Note that data structures throw runtime exceptions out of methods that don't have
- * checked exceptions in the signature.
- */
-public class GridCacheDataStructureInvalidException extends IgniteCheckedException {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /**
-     * Creates new exception with given error message.
-     *
-     * @param msg Error message.
-     */
-    public GridCacheDataStructureInvalidException(String msg) {
-        super(msg);
-    }
-
-    /**
-     * Creates new exception with given throwable as a nested cause and
-     * source of error message.
-     *
-     * @param cause Non-null throwable cause.
-     */
-    public GridCacheDataStructureInvalidException(Throwable cause) {
-        this(cause.getMessage(), cause);
-    }
-
-    /**
-     * Creates a new exception with given error message and optional nested cause exception.
-     *
-     * @param msg Error message.
-     * @param cause Optional nested exception (can be {@code null}).
-     */
-    public GridCacheDataStructureInvalidException(String msg, @Nullable Throwable cause) {
-        super(msg, cause);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheDataStructureInvalidRuntimeException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheDataStructureInvalidRuntimeException.java b/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheDataStructureInvalidRuntimeException.java
deleted file mode 100644
index 7ca87e1..0000000
--- a/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheDataStructureInvalidRuntimeException.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.cache.datastructures;
-
-import org.apache.ignite.*;
-import org.jetbrains.annotations.*;
-
-/**
- * This runtime exception gets thrown if attempt to access an invalid data structure has been made.
- * Data structure may become invalid if communication with remote nodes has been lost or
- * any other error condition happened that prevented from insuring consistent state.
- * <p>
- * The best way to handle this error is to discard the invalid data structure instance and try
- * getting the underlying data structure from cache again.
- * <p>
- * Note that data structures throw runtime exceptions out of methods that don't have
- * checked exceptions in the signature.
- */
-public class GridCacheDataStructureInvalidRuntimeException extends IgniteException {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /**
-     * Creates new exception with given error message.
-     *
-     * @param msg Error message.
-     */
-    public GridCacheDataStructureInvalidRuntimeException(String msg) {
-        super(msg);
-    }
-
-    /**
-     * Creates new exception with given throwable as a nested cause and
-     * source of error message.
-     *
-     * @param cause Non-null throwable cause.
-     */
-    public GridCacheDataStructureInvalidRuntimeException(Throwable cause) {
-        this(cause.getMessage(), cause);
-    }
-
-    /**
-     * Creates a new exception with given error message and optional nested cause exception.
-     *
-     * @param msg Error message.
-     * @param cause Optional nested exception (can be {@code null}).
-     */
-    public GridCacheDataStructureInvalidRuntimeException(String msg, @Nullable Throwable cause) {
-        super(msg, cause);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheDataStructureRemovedException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheDataStructureRemovedException.java b/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheDataStructureRemovedException.java
deleted file mode 100644
index 8427ee9..0000000
--- a/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheDataStructureRemovedException.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.cache.datastructures;
-
-import org.apache.ignite.*;
-import org.jetbrains.annotations.*;
-
-/**
- * This checked exception gets thrown if attempt to access a removed data structure has been made.
- * <p>
- * Note that data structures throw runtime exceptions out of methods that don't have
- * checked exceptions in the signature.
- */
-public class GridCacheDataStructureRemovedException extends IgniteCheckedException {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /**
-     * Creates new exception with given error message.
-     *
-     * @param msg Error message.
-     */
-    public GridCacheDataStructureRemovedException(String msg) {
-        super(msg);
-    }
-
-    /**
-     * Creates new exception with given throwable as a nested cause and
-     * source of error message.
-     *
-     * @param cause Non-null throwable cause.
-     */
-    public GridCacheDataStructureRemovedException(Throwable cause) {
-        this(cause.getMessage(), cause);
-    }
-
-    /**
-     * Creates a new exception with given error message and optional nested cause exception.
-     *
-     * @param msg Error message.
-     * @param cause Optional nested exception (can be {@code null}).
-     */
-    public GridCacheDataStructureRemovedException(String msg, @Nullable Throwable cause) {
-        super(msg, cause);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheDataStructureRemovedRuntimeException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheDataStructureRemovedRuntimeException.java b/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheDataStructureRemovedRuntimeException.java
deleted file mode 100644
index 31ebedf..0000000
--- a/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheDataStructureRemovedRuntimeException.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.cache.datastructures;
-
-import org.apache.ignite.*;
-import org.jetbrains.annotations.*;
-
-/**
- * This runtime exception gets thrown if attempt to access a removed data structure has been made.
- * <p>
- * Note that data structures throw runtime exceptions out of methods that don't have
- * checked exceptions in the signature.
- */
-public class GridCacheDataStructureRemovedRuntimeException extends IgniteException {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /**
-     * Creates new exception with given error message.
-     *
-     * @param msg Error message.
-     */
-    public GridCacheDataStructureRemovedRuntimeException(String msg) {
-        super(msg);
-    }
-
-    /**
-     * Creates new exception with given throwable as a nested cause and
-     * source of error message.
-     *
-     * @param cause Non-null throwable cause.
-     */
-    public GridCacheDataStructureRemovedRuntimeException(Throwable cause) {
-        this(cause.getMessage(), cause);
-    }
-
-    /**
-     * Creates a new exception with given error message and optional nested cause exception.
-     *
-     * @param msg Error message.
-     * @param cause Optional nested exception (can be {@code null}).
-     */
-    public GridCacheDataStructureRemovedRuntimeException(String msg, @Nullable Throwable cause) {
-        super(msg, cause);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheDataStructures.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheDataStructures.java b/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheDataStructures.java
deleted file mode 100644
index ccd5ddd..0000000
--- a/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheDataStructures.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.cache.datastructures;
-
-import org.apache.ignite.*;
-import org.jetbrains.annotations.*;
-
-/**
- * Facade for working with distributed cache data structures. All cache data structures are similar
- * in APIs to {@code 'java.util.concurrent'} package, but all operations on them are grid-aware.
- * For example, if you increment {@link GridCacheAtomicLong} on one node, another node will
- * know about the change. Or if you add an element to {@link GridCacheQueue} on one node,
- * you can poll it on another node.
- * <p>
- * You can get data structures facade by calling {@link org.apache.ignite.cache.GridCache#dataStructures()} method.
- */
-public interface GridCacheDataStructures {
-    /**
-     * Will get an atomic sequence from cache and create one if it has not been created yet and {@code create} flag
-     * is {@code true}.
-     *
-     * @param name Sequence name.
-     * @param initVal Initial value for sequence. If sequence already cached, {@code initVal} will be ignored.
-     * @param create Boolean flag indicating whether data structure should be created if does not exist.
-     * @return Sequence for the given name.
-     * @throws IgniteCheckedException If sequence could not be fetched or created.
-     */
-    @Nullable public GridCacheAtomicSequence atomicSequence(String name, long initVal, boolean create)
-        throws IgniteCheckedException;
-
-    /**
-     * Remove sequence from cache.
-     *
-     * @param name Sequence name.
-     * @return {@code True} if sequence has been removed, {@code false} otherwise.
-     * @throws IgniteCheckedException If remove failed.
-     */
-    public boolean removeAtomicSequence(String name) throws IgniteCheckedException;
-
-    /**
-     * Will get a atomic long from cache and create one if it has not been created yet and {@code create} flag
-     * is {@code true}.
-     *
-     * @param name Name of atomic long.
-     * @param initVal Initial value for atomic long. If atomic long already cached, {@code initVal}
-     *        will be ignored.
-     * @param create Boolean flag indicating whether data structure should be created if does not exist.
-     * @return Atomic long.
-     * @throws IgniteCheckedException If atomic long could not be fetched or created.
-     */
-    @Nullable public GridCacheAtomicLong atomicLong(String name, long initVal, boolean create) throws IgniteCheckedException;
-
-    /**
-     * Remove atomic long from cache.
-     *
-     * @param name Name of atomic long.
-     * @return {@code True} if atomic long has been removed, {@code false} otherwise.
-     * @throws IgniteCheckedException If removing failed.
-     */
-    public boolean removeAtomicLong(String name) throws IgniteCheckedException;
-
-    /**
-     * Will get a named queue from cache and create one if it has not been created yet and {@code create} flag
-     * is {@code true}.
-     * If queue is present in cache already, queue properties will not be changed. Use
-     * collocation for {@link org.apache.ignite.cache.CacheMode#PARTITIONED} caches if you have lots of relatively
-     * small queues as it will make fetching, querying, and iteration a lot faster. If you have
-     * few very large queues, then you should consider turning off collocation as they simply
-     * may not fit in a single node's memory. However note that in this case
-     * to get a single element off the queue all nodes may have to be queried.
-     *
-     * @param name Name of queue.
-     * @param cap Capacity of queue, {@code 0} for unbounded queue.
-     * @param collocated If {@code true} then all items within the same queue will be collocated on the same node.
-     *      Otherwise elements of the same queue maybe be cached on different nodes. If you have lots of relatively
-     *      small queues, then you should use collocation. If you have few large queues, then you should turn off
-     *      collocation. This parameter works only for {@link org.apache.ignite.cache.CacheMode#PARTITIONED} cache.
-     * @param create Boolean flag indicating whether data structure should be created if does not exist.
-     * @return Queue with given properties.
-     * @throws IgniteCheckedException If remove failed.
-     */
-    @Nullable public <T> GridCacheQueue<T> queue(String name, int cap, boolean collocated,
-        boolean create) throws IgniteCheckedException;
-
-    /**
-     * Remove queue from cache. Internally one transaction will be created for all elements
-     * in the queue. If you anticipate that queue may be large, then it's better to use
-     * {@link #removeQueue(String, int)} which allows to specify batch size. In that case
-     * transaction will be split into multiple transactions which will have upto {@code batchSize}
-     * elements in it.
-     *
-     * @param name Name queue.
-     * @return {@code True} if queue has been removed and false if it's not cached.
-     * @throws IgniteCheckedException If remove failed.
-     */
-    public boolean removeQueue(String name) throws IgniteCheckedException;
-
-    /**
-     * Remove queue from cache. Internally multiple transactions will be created
-     * with no more than {@code batchSize} elements in them. For larger queues, this
-     * method is preferrable over {@link #removeQueue(String)} which will create only
-     * one transaction for the whole operation.
-     *
-     * @param name Name queue.
-     * @param batchSize Batch size.
-     * @return {@code True} if queue has been removed and false if it's not cached.
-     * @throws IgniteCheckedException If remove failed.
-     */
-    public boolean removeQueue(String name, int batchSize) throws IgniteCheckedException;
-
-    /**
-     * Will get a named set from cache and create one if it has not been created yet and {@code create} flag
-     * is {@code true}.
-     *
-     * @param name Set name.
-     * @param collocated If {@code true} then all items within the same set will be collocated on the same node.
-     *      Otherwise elements of the same set maybe be cached on different nodes. This parameter works only
-     *      for {@link org.apache.ignite.cache.CacheMode#PARTITIONED} cache.
-     * @param create Flag indicating whether set should be created if does not exist.
-     * @return Set with given properties.
-     * @throws IgniteCheckedException If failed.
-     */
-    @Nullable public <T> GridCacheSet<T> set(String name, boolean collocated, boolean create) throws IgniteCheckedException;
-
-    /**
-     * Removes set from cache.
-     *
-     * @param name Set name.
-     * @return {@code True} if set has been removed and false if it's not cached.
-     * @throws IgniteCheckedException If failed.
-     */
-    public boolean removeSet(String name) throws IgniteCheckedException;
-
-    /**
-     * Will get a atomic reference from cache and create one if it has not been created yet and {@code create} flag
-     * is {@code true}.
-     *
-     * @param name Atomic reference name.
-     * @param initVal Initial value for atomic reference. If atomic reference already cached,
-     *      {@code initVal} will be ignored.
-     * @param create Boolean flag indicating whether data structure should be created if does not exist.
-     * @return Atomic reference for the given name.
-     * @throws IgniteCheckedException If atomic reference could not be fetched or created.
-     */
-    @Nullable public <T> GridCacheAtomicReference<T> atomicReference(String name, @Nullable T initVal, boolean create)
-        throws IgniteCheckedException;
-
-    /**
-     * Remove atomic reference from cache.
-     *
-     * @param name Atomic reference name.
-     * @return {@code True} if atomic reference has been removed, {@code false} otherwise.
-     * @throws IgniteCheckedException If remove failed.
-     */
-    public boolean removeAtomicReference(String name) throws IgniteCheckedException;
-
-    /**
-     * Will get a atomic stamped from cache and create one if it has not been created yet and {@code create} flag
-     * is {@code true}.
-     *
-     * @param name Atomic stamped name.
-     * @param initVal Initial value for atomic stamped. If atomic stamped already cached,
-     *      {@code initVal} will be ignored.
-     * @param initStamp Initial stamp for atomic stamped. If atomic stamped already cached,
-     *      {@code initStamp} will be ignored.
-     * @param create Boolean flag indicating whether data structure should be created if does not exist.
-     * @return Atomic stamped for the given name.
-     * @throws IgniteCheckedException If atomic stamped could not be fetched or created.
-     */
-    @Nullable public <T, S> GridCacheAtomicStamped<T, S> atomicStamped(String name, @Nullable T initVal,
-        @Nullable S initStamp, boolean create) throws IgniteCheckedException;
-
-    /**
-     * Remove atomic stamped from cache.
-     *
-     * @param name Atomic stamped name.
-     * @return {@code True} if atomic stamped has been removed, {@code false} otherwise.
-     * @throws IgniteCheckedException If remove failed.
-     */
-    public boolean removeAtomicStamped(String name) throws IgniteCheckedException;
-
-    /**
-     * Gets or creates count down latch. If count down latch is not found in cache and {@code create} flag
-     * is {@code true}, it is created using provided name and count parameter.
-     *
-     * @param name Name of the latch.
-     * @param cnt Count for new latch creation.
-     * @param autoDel {@code True} to automatically delete latch from cache
-     *      when its count reaches zero.
-     * @param create Boolean flag indicating whether data structure should be created if does not exist.
-     * @return Count down latch for the given name.
-     * @throws IgniteCheckedException If operation failed.
-     */
-    @Nullable public GridCacheCountDownLatch countDownLatch(String name, int cnt, boolean autoDel, boolean create)
-        throws IgniteCheckedException;
-
-    /**
-     * Removes count down latch from cache.
-     *
-     * @param name Name of the latch.
-     * @return Count down latch for the given name.
-     * @throws IgniteCheckedException If operation failed.
-     */
-    public boolean removeCountDownLatch(String name) throws IgniteCheckedException;
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheQueue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheQueue.java b/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheQueue.java
deleted file mode 100644
index 9636338..0000000
--- a/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheQueue.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.cache.datastructures;
-
-import org.apache.ignite.*;
-import org.jetbrains.annotations.*;
-
-import java.util.*;
-import java.util.concurrent.*;
-
-/**
- * This interface provides a rich API for working with distributed queues based on In-Memory Data Grid.
- * <p>
- * <h1 class="header">Overview</h1>
- * Cache queue provides an access to cache elements using typical queue API. Cache queue also implements
- * {@link Collection} interface and provides all methods from collections including
- * {@link Collection#addAll(Collection)}, {@link Collection#removeAll(Collection)}, and
- * {@link Collection#retainAll(Collection)} methods for bulk operations. Note that all
- * {@link Collection} methods in the queue may throw {@link IgniteException} in case
- * of failure.
- * <p>
- * All queue operations have synchronous and asynchronous counterparts.
- * <h1 class="header">Bounded vs Unbounded</h1>
- * Queues can be {@code unbounded} or {@code bounded}. {@code Bounded} queues can
- * have maximum capacity. Queue capacity can be set at creation time and cannot be
- * changed later. Here is an example of how to create {@code bounded} {@code LIFO} queue with
- * capacity of {@code 1000} items.
- * <pre name="code" class="java">
- * GridCacheQueue&lt;String&gt; queue = cache().queue("anyName", LIFO, 1000);
- * ...
- * queue.add("item");
- * </pre>
- * For {@code bounded} queues <b>blocking</b> operations, such as {@link #take()} or {@link #put(Object)}
- * are available. These operations will block until queue capacity changes to make the operation
- * possible.
- * <h1 class="header">Collocated vs Non-collocated</h1>
- * Queue items can be placed on one node or distributed throughout grid nodes
- * (governed by {@code collocated} parameter). {@code Non-collocated} mode is provided only
- * for partitioned caches. If {@code collocated} parameter is {@code true}, then all queue items
- * will be collocated on one node, otherwise items will be distributed through all grid nodes.
- * Unless explicitly specified, by default queues are {@code collocated}.
- * <p>
- * Here is an example of how create {@code unbounded} queue
- * in non-collocated mode.
- * <pre name="code" class="java">
- * GridCacheQueue&lt;String&gt; queue = cache().queue("anyName", 0 &#047;*unbounded*&#047;, false &#047;*non-collocated*&#047;);
- * ...
- * queue.add("item");
- * </pre>
- * <h1 class="header">Creating Cache Queues</h1>
- * Instances of distributed cache queues can be created by calling the following method
- * on {@link GridCacheDataStructures} API:
- * <ul>
- *     <li>{@link GridCacheDataStructures#queue(String, int, boolean, boolean)}</li>
- * </ul>
- * @see GridCacheDataStructures#queue(String, int, boolean, boolean)
- * @see GridCacheDataStructures#removeQueue(String)
- * @see GridCacheDataStructures#removeQueue(String, int)
- */
-public interface GridCacheQueue<T> extends BlockingQueue<T> {
-    /**
-     * Gets queue name.
-     *
-     * @return Queue name.
-     */
-    public String name();
-
-    /** {@inheritDoc} */
-    @Override public boolean add(T item) throws IgniteException;
-
-    /** {@inheritDoc} */
-    @Override public boolean offer(T item) throws IgniteException;
-
-    /** {@inheritDoc} */
-    @Override public boolean offer(T item, long timeout, TimeUnit unit) throws IgniteException;
-
-    /** {@inheritDoc} */
-    @Override public boolean addAll(Collection<? extends T> items) throws IgniteException;
-
-    /** {@inheritDoc} */
-    @Override public boolean contains(Object item) throws IgniteException;
-
-    /** {@inheritDoc} */
-    @Override public boolean containsAll(Collection<?> items) throws IgniteException;
-
-    /** {@inheritDoc} */
-    @Override public void clear() throws IgniteException;
-
-    /** {@inheritDoc} */
-    @Override public boolean remove(Object item) throws IgniteException;
-
-    /** {@inheritDoc} */
-    @Override public boolean removeAll(Collection<?> items) throws IgniteException;
-
-    /** {@inheritDoc} */
-    @Override public boolean isEmpty() throws IgniteException;
-
-    /** {@inheritDoc} */
-    @Override public Iterator<T> iterator() throws IgniteException;
-
-    /** {@inheritDoc} */
-    @Override public Object[] toArray() throws IgniteException;
-
-    /** {@inheritDoc} */
-    @Override public <T> T[] toArray(T[] a) throws IgniteException;
-
-    /** {@inheritDoc} */
-    @Override public boolean retainAll(Collection<?> items) throws IgniteException;
-
-    /** {@inheritDoc} */
-    @Override public int size() throws IgniteException;
-
-    /** {@inheritDoc} */
-    @Override @Nullable public T poll() throws IgniteException;
-
-    /** {@inheritDoc} */
-    @Override @Nullable public T peek() throws IgniteException;
-
-    /** {@inheritDoc} */
-    @Override public void put(T item) throws IgniteException;
-
-    /** {@inheritDoc} */
-    @Override @Nullable public T take() throws IgniteException;
-
-    /** {@inheritDoc} */
-    @Override @Nullable public T poll(long timeout, TimeUnit unit) throws IgniteException;
-
-    /**
-     * Removes all of the elements from this queue. Method is used in massive queues with huge numbers of elements.
-     *
-     * @param batchSize Batch size.
-     * @throws IgniteException if operation failed.
-     */
-    public void clear(int batchSize) throws IgniteException;
-
-    /**
-     * Gets maximum number of elements of the queue.
-     *
-     * @return Maximum number of elements. If queue is unbounded {@code Integer.MAX_SIZE} will return.
-     * @throws IgniteCheckedException If operation failed.
-     */
-    public int capacity() throws IgniteCheckedException;
-
-    /**
-     * Returns {@code true} if this queue is bounded.
-     *
-     * @return {@code true} if this queue is bounded.
-     * @throws IgniteCheckedException If operation failed.
-     */
-    public boolean bounded() throws IgniteCheckedException;
-
-    /**
-     * Returns {@code true} if this queue can be kept on the one node only.
-     * Returns {@code false} if this queue can be kept on the many nodes.
-     *
-     * @return {@code true} if this queue is in {@code collocated} mode {@code false} otherwise.
-     * @throws IgniteCheckedException If operation failed.
-     */
-    public boolean collocated() throws IgniteCheckedException;
-
-    /**
-     * Gets status of queue.
-     *
-     * @return {@code true} if queue was removed from cache {@code false} otherwise.
-     */
-    public boolean removed();
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheSet.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheSet.java b/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheSet.java
deleted file mode 100644
index 37f7c80..0000000
--- a/modules/core/src/main/java/org/apache/ignite/cache/datastructures/GridCacheSet.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.cache.datastructures;
-
-import org.apache.ignite.*;
-
-import java.util.*;
-
-/**
- * Set implementation based on on In-Memory Data Grid.
- * <h1 class="header">Overview</h1>
- * Cache set implements {@link Set} interface and provides all methods from collections.
- * Note that all {@link Collection} methods in the set may throw {@link IgniteException} in case of failure
- * or if set was removed.
- * <h1 class="header">Collocated vs Non-collocated</h1>
- * Set items can be placed on one node or distributed throughout grid nodes
- * (governed by {@code collocated} parameter). {@code Non-collocated} mode is provided only
- * for partitioned caches. If {@code collocated} parameter is {@code true}, then all set items
- * will be collocated on one node, otherwise items will be distributed through all grid nodes.
- * @see GridCacheDataStructures#set(String, boolean, boolean)
- * @see GridCacheDataStructures#removeSet(String)
- */
-public interface GridCacheSet<T> extends Set<T> {
-    /**
-     * Gets set name.
-     *
-     * @return Set name.
-     */
-    public String name();
-
-    /**
-     * Returns {@code true} if this set can be kept on the one node only.
-     * Returns {@code false} if this set can be kept on the many nodes.
-     *
-     * @return {@code True} if this set is in {@code collocated} mode {@code false} otherwise.
-     * @throws IgniteCheckedException If operation failed.
-     */
-    public boolean collocated() throws IgniteCheckedException;
-
-    /**
-     * Gets status of set.
-     *
-     * @return {@code True} if set was removed from cache {@code false} otherwise.
-     */
-    public boolean removed();
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/eviction/CacheEvictionFilter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/CacheEvictionFilter.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/CacheEvictionFilter.java
new file mode 100644
index 0000000..3833bae
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/CacheEvictionFilter.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.cache.eviction;
+
+import org.apache.ignite.cache.*;
+
+/**
+ * Eviction filter to specify which entries should not be evicted. Not applicable when
+ * calling explicit evict via {@link org.apache.ignite.cache.CacheEntry#evict()}.
+ * If {@link #evictAllowed(org.apache.ignite.cache.CacheEntry)} method returns {@code false} then eviction
+ * policy will not be notified and entry will never be evicted.
+ * <p>
+ * Eviction filter can be configured via {@link CacheConfiguration#getEvictionFilter()}
+ * configuration property. Default value is {@code null} which means that all
+ * cache entries will be tracked by eviction policy.
+ */
+public interface CacheEvictionFilter<K, V> {
+    /**
+     * Checks if entry may be evicted from cache.
+     *
+     * @param entry Cache entry.
+     * @return {@code True} if it is allowed to evict this entry.
+     */
+    public boolean evictAllowed(CacheEntry<K, V> entry);
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/eviction/CacheEvictionPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/CacheEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/CacheEvictionPolicy.java
new file mode 100644
index 0000000..44f36a6
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/CacheEvictionPolicy.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.cache.eviction;
+
+import org.apache.ignite.cache.*;
+
+/**
+ * Pluggable cache eviction policy. Usually, implementations will internally order
+ * cache entries based on {@link #onEntryAccessed(boolean, org.apache.ignite.cache.CacheEntry)} notifications and
+ * whenever an element needs to be evicted, {@link org.apache.ignite.cache.CacheEntry#evict()}
+ * method should be called. If you need to access the underlying cache directly
+ * from this policy, you can get it via {@link org.apache.ignite.cache.CacheEntry#projection()} method.
+ * <p>
+ * GridGain comes with following eviction policies out-of-the-box:
+ * <ul>
+ * <li>{@link org.apache.ignite.cache.eviction.lru.CacheLruEvictionPolicy}</li>
+ * <li>{@link org.apache.ignite.cache.eviction.random.CacheRandomEvictionPolicy}</li>
+ * <li>{@link org.apache.ignite.cache.eviction.fifo.CacheFifoEvictionPolicy}</li>
+ * </ul>
+ * <p>
+ * The eviction policy thread-safety is ensured by GridGain. Implementations of this interface should
+ * not worry about concurrency and should be implemented as they were only accessed from one thread.
+ * <p>
+ * Note that implementations of all eviction policies provided by GridGain are very
+ * light weight in a way that they are all lock-free (or very close to it), and do not
+ * create any internal tables, arrays, or other expensive structures.
+ * The eviction order is preserved by attaching light-weight meta-data to existing
+ * cache entries.
+ */
+public interface CacheEvictionPolicy<K, V> {
+    /**
+     * Callback for whenever entry is accessed.
+     *
+     * @param rmv {@code True} if entry has been removed, {@code false} otherwise.
+     * @param entry Accessed entry.
+     */
+    public void onEntryAccessed(boolean rmv, CacheEntry<K, V> entry);
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/eviction/EvictableEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/EvictableEntry.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/EvictableEntry.java
index ce5fb82..5c940b3 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/EvictableEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/EvictableEntry.java
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.*;
 import javax.cache.*;
 
 /**
- * Evictable cache entry passed into {@link org.apache.ignite.cache.eviction.GridCacheEvictionPolicy}.
+ * Evictable cache entry passed into {@link CacheEvictionPolicy}.
  *
  * @author @java.author
  * @version @java.version

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/eviction/GridCacheEvictionFilter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/GridCacheEvictionFilter.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/GridCacheEvictionFilter.java
deleted file mode 100644
index d07a0af..0000000
--- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/GridCacheEvictionFilter.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.cache.eviction;
-
-import org.apache.ignite.cache.*;
-
-/**
- * Eviction filter to specify which entries should not be evicted. Not applicable when
- * calling explicit evict via {@link org.apache.ignite.cache.GridCacheEntry#evict()}.
- * If {@link #evictAllowed(org.apache.ignite.cache.GridCacheEntry)} method returns {@code false} then eviction
- * policy will not be notified and entry will never be evicted.
- * <p>
- * Eviction filter can be configured via {@link CacheConfiguration#getEvictionFilter()}
- * configuration property. Default value is {@code null} which means that all
- * cache entries will be tracked by eviction policy.
- */
-public interface GridCacheEvictionFilter<K, V> {
-    /**
-     * Checks if entry may be evicted from cache.
-     *
-     * @param entry Cache entry.
-     * @return {@code True} if it is allowed to evict this entry.
-     */
-    public boolean evictAllowed(GridCacheEntry<K, V> entry);
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/eviction/GridCacheEvictionPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/GridCacheEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/GridCacheEvictionPolicy.java
deleted file mode 100644
index 36d740d..0000000
--- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/GridCacheEvictionPolicy.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.cache.eviction;
-
-import org.apache.ignite.cache.*;
-
-/**
- * Pluggable cache eviction policy. Usually, implementations will internally order
- * cache entries based on {@link #onEntryAccessed(boolean, org.apache.ignite.cache.GridCacheEntry)} notifications and
- * whenever an element needs to be evicted, {@link org.apache.ignite.cache.GridCacheEntry#evict()}
- * method should be called. If you need to access the underlying cache directly
- * from this policy, you can get it via {@link org.apache.ignite.cache.GridCacheEntry#projection()} method.
- * <p>
- * GridGain comes with following eviction policies out-of-the-box:
- * <ul>
- * <li>{@link org.apache.ignite.cache.eviction.lru.GridCacheLruEvictionPolicy}</li>
- * <li>{@link org.apache.ignite.cache.eviction.random.GridCacheRandomEvictionPolicy}</li>
- * <li>{@link org.apache.ignite.cache.eviction.fifo.GridCacheFifoEvictionPolicy}</li>
- * </ul>
- * <p>
- * The eviction policy thread-safety is ensured by GridGain. Implementations of this interface should
- * not worry about concurrency and should be implemented as they were only accessed from one thread.
- * <p>
- * Note that implementations of all eviction policies provided by GridGain are very
- * light weight in a way that they are all lock-free (or very close to it), and do not
- * create any internal tables, arrays, or other expensive structures.
- * The eviction order is preserved by attaching light-weight meta-data to existing
- * cache entries.
- */
-public interface GridCacheEvictionPolicy<K, V> {
-    /**
-     * Callback for whenever entry is accessed.
-     *
-     * @param rmv {@code True} if entry has been removed, {@code false} otherwise.
-     * @param entry Accessed entry.
-     */
-    public void onEntryAccessed(boolean rmv, GridCacheEntry<K, V> entry);
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/CacheFifoEvictionPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/CacheFifoEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/CacheFifoEvictionPolicy.java
new file mode 100644
index 0000000..981fdc3
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/CacheFifoEvictionPolicy.java
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.cache.eviction.fifo;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.eviction.*;
+import org.jdk8.backport.*;
+import org.jdk8.backport.ConcurrentLinkedDeque8.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+
+import java.util.*;
+
+/**
+ * Eviction policy based on {@code First In First Out (FIFO)} algorithm. This
+ * implementation is very efficient since it does not create any additional
+ * table-like data structures. The {@code FIFO} ordering information is
+ * maintained by attaching ordering metadata to cache entries.
+ */
+public class CacheFifoEvictionPolicy<K, V> implements CacheEvictionPolicy<K, V>,
+    CacheFifoEvictionPolicyMBean {
+    /** Tag. */
+    private final String meta = UUID.randomUUID().toString();
+
+    /** Maximum size. */
+    private volatile int max = CacheConfiguration.DFLT_CACHE_SIZE;
+
+    /** FIFO queue. */
+    private final ConcurrentLinkedDeque8<CacheEntry<K, V>> queue =
+        new ConcurrentLinkedDeque8<>();
+
+    /**
+     * Constructs FIFO eviction policy with all defaults.
+     */
+    public CacheFifoEvictionPolicy() {
+        // No-op.
+    }
+
+    /**
+     * Constructs FIFO eviction policy with maximum size. Empty entries are allowed.
+     *
+     * @param max Maximum allowed size of cache before entry will start getting evicted.
+     */
+    public CacheFifoEvictionPolicy(int max) {
+        A.ensure(max > 0, "max > 0");
+
+        this.max = max;
+    }
+
+    /**
+     * Gets maximum allowed size of cache before entry will start getting evicted.
+     *
+     * @return Maximum allowed size of cache before entry will start getting evicted.
+     */
+    @Override public int getMaxSize() {
+        return max;
+    }
+
+    /**
+     * Sets maximum allowed size of cache before entry will start getting evicted.
+     *
+     * @param max Maximum allowed size of cache before entry will start getting evicted.
+     */
+    @Override public void setMaxSize(int max) {
+        A.ensure(max > 0, "max > 0");
+
+        this.max = max;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getCurrentSize() {
+        return queue.size();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getMetaAttributeName() {
+        return meta;
+    }
+
+    /**
+     * Gets read-only view on internal {@code FIFO} queue in proper order.
+     *
+     * @return Read-only view ono internal {@code 'FIFO'} queue.
+     */
+    public Collection<CacheEntry<K, V>> queue() {
+        return Collections.unmodifiableCollection(queue);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onEntryAccessed(boolean rmv, CacheEntry<K, V> entry) {
+        if (!rmv) {
+            if (!entry.isCached())
+                return;
+
+            // Shrink only if queue was changed.
+            if (touch(entry))
+                shrink();
+        }
+        else {
+            Node<CacheEntry<K, V>> node = entry.removeMeta(meta);
+
+            if (node != null)
+                queue.unlinkx(node);
+        }
+    }
+
+    /**
+     * @param entry Entry to touch.
+     * @return {@code True} if queue has been changed by this call.
+     */
+    private boolean touch(CacheEntry<K, V> entry) {
+        Node<CacheEntry<K, V>> node = entry.meta(meta);
+
+        // Entry has not been enqueued yet.
+        if (node == null) {
+            while (true) {
+                node = queue.offerLastx(entry);
+
+                if (entry.putMetaIfAbsent(meta, node) != null) {
+                    // Was concurrently added, need to clear it from queue.
+                    queue.unlinkx(node);
+
+                    // Queue has not been changed.
+                    return false;
+                }
+                else if (node.item() != null) {
+                    if (!entry.isCached()) {
+                        // Was concurrently evicted, need to clear it from queue.
+                        queue.unlinkx(node);
+
+                        return false;
+                    }
+
+                    return true;
+                }
+                // If node was unlinked by concurrent shrink() call, we must repeat the whole cycle.
+                else if (!entry.removeMeta(meta, node))
+                    return false;
+            }
+        }
+
+        // Entry is already in queue.
+        return false;
+    }
+
+    /**
+     * Shrinks FIFO queue to maximum allowed size.
+     */
+    private void shrink() {
+        int max = this.max;
+
+        int startSize = queue.sizex();
+
+        for (int i = 0; i < startSize && queue.sizex() > max; i++) {
+            CacheEntry<K, V> entry = queue.poll();
+
+            if (entry == null)
+                break;
+
+            if (!entry.evict()) {
+                entry.removeMeta(meta);
+
+                touch(entry);
+            }
+        }
+    }
+
+    /**
+     * Checks entry for empty value.
+     *
+     * @param entry Entry to check.
+     * @return {@code True} if entry is empty.
+     */
+    private boolean empty(CacheEntry<K, V> entry) {
+        try {
+            return entry.peek(F.asList(GridCachePeekMode.GLOBAL)) == null;
+        }
+        catch (IgniteCheckedException e) {
+            U.error(null, e.getMessage(), e);
+
+            assert false : "Should never happen: " + e;
+
+            return false;
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(CacheFifoEvictionPolicy.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/CacheFifoEvictionPolicyMBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/CacheFifoEvictionPolicyMBean.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/CacheFifoEvictionPolicyMBean.java
new file mode 100644
index 0000000..6289306
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/CacheFifoEvictionPolicyMBean.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.cache.eviction.fifo;
+
+import org.apache.ignite.mbean.*;
+
+/**
+ * MBean for {@code FIFO} eviction policy.
+ */
+@IgniteMBeanDescription("MBean for FIFO cache eviction policy.")
+public interface CacheFifoEvictionPolicyMBean {
+    /**
+     * Gets name of metadata attribute used to store eviction policy data.
+     *
+     * @return Name of metadata attribute used to store eviction policy data.
+     */
+    @IgniteMBeanDescription("Name of metadata attribute used to store eviction policy data.")
+    public String getMetaAttributeName();
+
+    /**
+     * Gets maximum allowed cache size.
+     *
+     * @return Maximum allowed cache size.
+     */
+    @IgniteMBeanDescription("Maximum allowed cache size.")
+    public int getMaxSize();
+
+    /**
+     * Sets maximum allowed cache size.
+     *
+     * @param max Maximum allowed cache size.
+     */
+    @IgniteMBeanDescription("Set maximum allowed cache size.")
+    public void setMaxSize(int max);
+
+    /**
+     * Gets current queue size.
+     *
+     * @return Current queue size.
+     */
+    @IgniteMBeanDescription("Current FIFO queue size.")
+    public int getCurrentSize();
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/GridCacheFifoEvictionPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/GridCacheFifoEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/GridCacheFifoEvictionPolicy.java
deleted file mode 100644
index cc73355..0000000
--- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/GridCacheFifoEvictionPolicy.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.cache.eviction.fifo;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.cache.eviction.*;
-import org.jdk8.backport.*;
-import org.jdk8.backport.ConcurrentLinkedDeque8.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-
-import java.util.*;
-
-/**
- * Eviction policy based on {@code First In First Out (FIFO)} algorithm. This
- * implementation is very efficient since it does not create any additional
- * table-like data structures. The {@code FIFO} ordering information is
- * maintained by attaching ordering metadata to cache entries.
- */
-public class GridCacheFifoEvictionPolicy<K, V> implements GridCacheEvictionPolicy<K, V>,
-    GridCacheFifoEvictionPolicyMBean {
-    /** Tag. */
-    private final String meta = UUID.randomUUID().toString();
-
-    /** Maximum size. */
-    private volatile int max = CacheConfiguration.DFLT_CACHE_SIZE;
-
-    /** FIFO queue. */
-    private final ConcurrentLinkedDeque8<GridCacheEntry<K, V>> queue =
-        new ConcurrentLinkedDeque8<>();
-
-    /**
-     * Constructs FIFO eviction policy with all defaults.
-     */
-    public GridCacheFifoEvictionPolicy() {
-        // No-op.
-    }
-
-    /**
-     * Constructs FIFO eviction policy with maximum size. Empty entries are allowed.
-     *
-     * @param max Maximum allowed size of cache before entry will start getting evicted.
-     */
-    public GridCacheFifoEvictionPolicy(int max) {
-        A.ensure(max > 0, "max > 0");
-
-        this.max = max;
-    }
-
-    /**
-     * Gets maximum allowed size of cache before entry will start getting evicted.
-     *
-     * @return Maximum allowed size of cache before entry will start getting evicted.
-     */
-    @Override public int getMaxSize() {
-        return max;
-    }
-
-    /**
-     * Sets maximum allowed size of cache before entry will start getting evicted.
-     *
-     * @param max Maximum allowed size of cache before entry will start getting evicted.
-     */
-    @Override public void setMaxSize(int max) {
-        A.ensure(max > 0, "max > 0");
-
-        this.max = max;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getCurrentSize() {
-        return queue.size();
-    }
-
-    /** {@inheritDoc} */
-    @Override public String getMetaAttributeName() {
-        return meta;
-    }
-
-    /**
-     * Gets read-only view on internal {@code FIFO} queue in proper order.
-     *
-     * @return Read-only view ono internal {@code 'FIFO'} queue.
-     */
-    public Collection<GridCacheEntry<K, V>> queue() {
-        return Collections.unmodifiableCollection(queue);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void onEntryAccessed(boolean rmv, GridCacheEntry<K, V> entry) {
-        if (!rmv) {
-            if (!entry.isCached())
-                return;
-
-            // Shrink only if queue was changed.
-            if (touch(entry))
-                shrink();
-        }
-        else {
-            Node<GridCacheEntry<K, V>> node = entry.removeMeta(meta);
-
-            if (node != null)
-                queue.unlinkx(node);
-        }
-    }
-
-    /**
-     * @param entry Entry to touch.
-     * @return {@code True} if queue has been changed by this call.
-     */
-    private boolean touch(GridCacheEntry<K, V> entry) {
-        Node<GridCacheEntry<K, V>> node = entry.meta(meta);
-
-        // Entry has not been enqueued yet.
-        if (node == null) {
-            while (true) {
-                node = queue.offerLastx(entry);
-
-                if (entry.putMetaIfAbsent(meta, node) != null) {
-                    // Was concurrently added, need to clear it from queue.
-                    queue.unlinkx(node);
-
-                    // Queue has not been changed.
-                    return false;
-                }
-                else if (node.item() != null) {
-                    if (!entry.isCached()) {
-                        // Was concurrently evicted, need to clear it from queue.
-                        queue.unlinkx(node);
-
-                        return false;
-                    }
-
-                    return true;
-                }
-                // If node was unlinked by concurrent shrink() call, we must repeat the whole cycle.
-                else if (!entry.removeMeta(meta, node))
-                    return false;
-            }
-        }
-
-        // Entry is already in queue.
-        return false;
-    }
-
-    /**
-     * Shrinks FIFO queue to maximum allowed size.
-     */
-    private void shrink() {
-        int max = this.max;
-
-        int startSize = queue.sizex();
-
-        for (int i = 0; i < startSize && queue.sizex() > max; i++) {
-            GridCacheEntry<K, V> entry = queue.poll();
-
-            if (entry == null)
-                break;
-
-            if (!entry.evict()) {
-                entry.removeMeta(meta);
-
-                touch(entry);
-            }
-        }
-    }
-
-    /**
-     * Checks entry for empty value.
-     *
-     * @param entry Entry to check.
-     * @return {@code True} if entry is empty.
-     */
-    private boolean empty(GridCacheEntry<K, V> entry) {
-        try {
-            return entry.peek(F.asList(GridCachePeekMode.GLOBAL)) == null;
-        }
-        catch (IgniteCheckedException e) {
-            U.error(null, e.getMessage(), e);
-
-            assert false : "Should never happen: " + e;
-
-            return false;
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridCacheFifoEvictionPolicy.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/GridCacheFifoEvictionPolicyMBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/GridCacheFifoEvictionPolicyMBean.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/GridCacheFifoEvictionPolicyMBean.java
deleted file mode 100644
index a330cad..0000000
--- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/GridCacheFifoEvictionPolicyMBean.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.cache.eviction.fifo;
-
-import org.apache.ignite.mbean.*;
-
-/**
- * MBean for {@code FIFO} eviction policy.
- */
-@IgniteMBeanDescription("MBean for FIFO cache eviction policy.")
-public interface GridCacheFifoEvictionPolicyMBean {
-    /**
-     * Gets name of metadata attribute used to store eviction policy data.
-     *
-     * @return Name of metadata attribute used to store eviction policy data.
-     */
-    @IgniteMBeanDescription("Name of metadata attribute used to store eviction policy data.")
-    public String getMetaAttributeName();
-
-    /**
-     * Gets maximum allowed cache size.
-     *
-     * @return Maximum allowed cache size.
-     */
-    @IgniteMBeanDescription("Maximum allowed cache size.")
-    public int getMaxSize();
-
-    /**
-     * Sets maximum allowed cache size.
-     *
-     * @param max Maximum allowed cache size.
-     */
-    @IgniteMBeanDescription("Set maximum allowed cache size.")
-    public void setMaxSize(int max);
-
-    /**
-     * Gets current queue size.
-     *
-     * @return Current queue size.
-     */
-    @IgniteMBeanDescription("Current FIFO queue size.")
-    public int getCurrentSize();
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/eviction/ggfs/CacheGgfsEvictionFilter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/ggfs/CacheGgfsEvictionFilter.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/ggfs/CacheGgfsEvictionFilter.java
new file mode 100644
index 0000000..124b17c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/ggfs/CacheGgfsEvictionFilter.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.cache.eviction.ggfs;
+
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.eviction.*;
+import org.apache.ignite.internal.processors.fs.*;
+
+/**
+ * GGFS eviction filter which will not evict blocks of particular files.
+ */
+public class CacheGgfsEvictionFilter implements CacheEvictionFilter {
+    /** {@inheritDoc} */
+    @Override public boolean evictAllowed(CacheEntry entry) {
+        Object key = entry.getKey();
+
+        return !(key instanceof GridGgfsBlockKey && ((GridGgfsBlockKey)key).evictExclude());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/eviction/ggfs/CacheGgfsPerBlockLruEvictionPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/ggfs/CacheGgfsPerBlockLruEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/ggfs/CacheGgfsPerBlockLruEvictionPolicy.java
new file mode 100644
index 0000000..f1d5cdf
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/ggfs/CacheGgfsPerBlockLruEvictionPolicy.java
@@ -0,0 +1,353 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.cache.eviction.ggfs;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.eviction.*;
+import org.apache.ignite.fs.*;
+import org.apache.ignite.internal.processors.fs.*;
+import org.jdk8.backport.*;
+import org.jdk8.backport.ConcurrentLinkedDeque8.*;
+import org.jetbrains.annotations.*;
+
+import java.util.*;
+import java.util.concurrent.atomic.*;
+import java.util.regex.*;
+
+/**
+ * GGFS eviction policy which evicts particular blocks.
+ */
+public class CacheGgfsPerBlockLruEvictionPolicy implements CacheEvictionPolicy<GridGgfsBlockKey, byte[]>,
+    CacheGgfsPerBlockLruEvictionPolicyMBean {
+    /** Meta denoting node in the queue. */
+    public static final String META_NODE = "ggfs_node";
+
+    /** Maximum size. When reached, eviction begins. */
+    private volatile long maxSize;
+
+    /** Maximum amount of blocks. When reached, eviction begins. */
+    private volatile int maxBlocks;
+
+    /** Collection of regex for paths which must not be evicted. */
+    private volatile Collection<String> excludePaths;
+
+    /** Exclusion patterns. */
+    private volatile Collection<Pattern> excludePatterns;
+
+    /** Whether patterns must be recompiled during the next call. */
+    private final AtomicBoolean excludeRecompile = new AtomicBoolean(true);
+
+    /** Queue. */
+    private final ConcurrentLinkedDeque8<CacheEntry<GridGgfsBlockKey, byte[]>> queue =
+        new ConcurrentLinkedDeque8<>();
+
+    /** Current size of all enqueued blocks in bytes. */
+    private final LongAdder curSize = new LongAdder();
+
+    /**
+     * Default constructor.
+     */
+    public CacheGgfsPerBlockLruEvictionPolicy() {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param maxSize Maximum size. When reached, eviction begins.
+     * @param maxBlocks Maximum amount of blocks. When reached, eviction begins.
+     */
+    public CacheGgfsPerBlockLruEvictionPolicy(long maxSize, int maxBlocks) {
+        this(maxSize, maxBlocks, null);
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param maxSize Maximum size. When reached, eviction begins.
+     * @param maxBlocks Maximum amount of blocks. When reached, eviction begins.
+     * @param excludePaths Collection of regex for path which must not be evicted.
+     */
+    public CacheGgfsPerBlockLruEvictionPolicy(long maxSize, int maxBlocks,
+                                              @Nullable Collection<String> excludePaths) {
+        this.maxSize = maxSize;
+        this.maxBlocks = maxBlocks;
+        this.excludePaths = excludePaths;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onEntryAccessed(boolean rmv, CacheEntry<GridGgfsBlockKey, byte[]> entry) {
+        if (!rmv) {
+            if (!entry.isCached())
+                return;
+
+            if (touch(entry))
+                shrink();
+        }
+        else {
+            MetaEntry meta = entry.removeMeta(META_NODE);
+
+            if (meta != null && queue.unlinkx(meta.node()))
+                changeSize(-meta.size());
+        }
+    }
+
+    /**
+     * @param entry Entry to touch.
+     * @return {@code True} if new node has been added to queue by this call.
+     */
+    private boolean touch(CacheEntry<GridGgfsBlockKey, byte[]> entry) {
+        byte[] val = entry.peek();
+
+        int blockSize = val != null ? val.length : 0;
+
+        MetaEntry meta = entry.meta(META_NODE);
+
+        // Entry has not been enqueued yet.
+        if (meta == null) {
+            while (true) {
+                Node<CacheEntry<GridGgfsBlockKey, byte[]>> node = queue.offerLastx(entry);
+
+                meta = new MetaEntry(node, blockSize);
+
+                if (entry.putMetaIfAbsent(META_NODE, meta) != null) {
+                    // Was concurrently added, need to clear it from queue.
+                    queue.unlinkx(node);
+
+                    // Queue has not been changed.
+                    return false;
+                }
+                else if (node.item() != null) {
+                    if (!entry.isCached()) {
+                        // Was concurrently evicted, need to clear it from queue.
+                        queue.unlinkx(node);
+
+                        return false;
+                    }
+
+                    // Increment current size.
+                    changeSize(blockSize);
+
+                    return true;
+                }
+                // If node was unlinked by concurrent shrink() call, we must repeat the whole cycle.
+                else if (!entry.removeMeta(META_NODE, node))
+                    return false;
+            }
+        }
+        else {
+            int oldBlockSize = meta.size();
+
+            Node<CacheEntry<GridGgfsBlockKey, byte[]>> node = meta.node();
+
+            if (queue.unlinkx(node)) {
+                // Move node to tail.
+                Node<CacheEntry<GridGgfsBlockKey, byte[]>> newNode = queue.offerLastx(entry);
+
+                int delta = blockSize - oldBlockSize;
+
+                if (!entry.replaceMeta(META_NODE, meta, new MetaEntry(newNode, blockSize))) {
+                    // Was concurrently added, need to clear it from queue.
+                    if (queue.unlinkx(newNode))
+                        delta -= blockSize;
+                }
+
+                if (delta != 0) {
+                    changeSize(delta);
+
+                   if (delta > 0)
+                       // Total size increased, so shrinking could be needed.
+                       return true;
+                }
+            }
+        }
+
+        // Entry is already in queue.
+        return false;
+    }
+
+    /**
+     * Shrinks queue to maximum allowed size.
+     */
+    private void shrink() {
+        long maxSize = this.maxSize;
+        int maxBlocks = this.maxBlocks;
+
+        int cnt = queue.sizex();
+
+        for (int i = 0; i < cnt && (maxBlocks > 0 && queue.sizex() > maxBlocks ||
+            maxSize > 0 && curSize.longValue() > maxSize); i++) {
+            CacheEntry<GridGgfsBlockKey, byte[]> entry = queue.poll();
+
+            if (entry == null)
+                break; // Queue is empty.
+
+            byte[] val = entry.peek();
+
+            if (val != null)
+                changeSize(-val.length); // Change current size as we polled entry from the queue.
+
+            if (!entry.evict()) {
+                // Reorder entries which we failed to evict.
+                entry.removeMeta(META_NODE);
+
+                touch(entry);
+            }
+        }
+    }
+
+    /**
+     * Change current size.
+     *
+     * @param delta Delta in bytes.
+     */
+    private void changeSize(int delta) {
+        if (delta != 0)
+            curSize.add(delta);
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getMaxSize() {
+        return maxSize;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setMaxSize(long maxSize) {
+        this.maxSize = maxSize;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getMaxBlocks() {
+        return maxBlocks;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setMaxBlocks(int maxBlocks) {
+        this.maxBlocks = maxBlocks;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Collection<String> getExcludePaths() {
+        return Collections.unmodifiableCollection(excludePaths);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setExcludePaths(@Nullable Collection<String> excludePaths) {
+        this.excludePaths = excludePaths;
+
+        excludeRecompile.set(true);
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getCurrentSize() {
+        return curSize.longValue();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getCurrentBlocks() {
+        return queue.size();
+    }
+
+    /**
+     * Check whether provided path must be excluded from evictions.
+     *
+     * @param path Path.
+     * @return {@code True} in case non block of related file must be excluded.
+     * @throws IgniteCheckedException In case of faulty patterns.
+     */
+    public boolean exclude(IgniteFsPath path) throws IgniteCheckedException {
+        assert path != null;
+
+        Collection<Pattern> excludePatterns0;
+
+        if (excludeRecompile.compareAndSet(true, false)) {
+            // Recompile.
+            Collection<String> excludePaths0 = excludePaths;
+
+            if (excludePaths0 != null) {
+                excludePatterns0 = new HashSet<>(excludePaths0.size(), 1.0f);
+
+                for (String excludePath : excludePaths0) {
+                    try {
+                        excludePatterns0.add(Pattern.compile(excludePath));
+                    }
+                    catch (PatternSyntaxException ignore) {
+                        throw new IgniteCheckedException("Invalid regex pattern: " + excludePath);
+                    }
+                }
+
+                excludePatterns = excludePatterns0;
+            }
+            else
+                excludePatterns0 = excludePatterns = null;
+        }
+        else
+            excludePatterns0 = excludePatterns;
+
+        if (excludePatterns0 != null) {
+            String pathStr = path.toString();
+
+            for (Pattern pattern : excludePatterns0) {
+                if (pattern.matcher(pathStr).matches())
+                    return true;
+            }
+        }
+
+        return false;
+    }
+
+    /**
+     * Meta entry.
+     */
+    private static class MetaEntry {
+        /** Queue node. */
+        private final Node<CacheEntry<GridGgfsBlockKey, byte[]>> node;
+
+        /** Data size. */
+        private final int size;
+
+        /**
+         * Constructor.
+         *
+         * @param node Queue node.
+         * @param size Data size.
+         */
+        private MetaEntry(Node<CacheEntry<GridGgfsBlockKey, byte[]>> node, int size) {
+            assert node != null;
+            assert size >= 0;
+
+            this.node = node;
+            this.size = size;
+        }
+
+        /**
+         * @return Queue node.
+         */
+        private Node<CacheEntry<GridGgfsBlockKey, byte[]>> node() {
+            return node;
+        }
+
+        /**
+         * @return Data size.
+         */
+        private int size() {
+            return size;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/eviction/ggfs/CacheGgfsPerBlockLruEvictionPolicyMBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/ggfs/CacheGgfsPerBlockLruEvictionPolicyMBean.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/ggfs/CacheGgfsPerBlockLruEvictionPolicyMBean.java
new file mode 100644
index 0000000..d0026dc
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/ggfs/CacheGgfsPerBlockLruEvictionPolicyMBean.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.cache.eviction.ggfs;
+
+import org.apache.ignite.mbean.*;
+import org.jetbrains.annotations.*;
+
+import java.util.*;
+
+/**
+ * MBean for {@code GGFS per-block LRU} eviction policy.
+ */
+@IgniteMBeanDescription("MBean for GGFS per-block LRU cache eviction policy.")
+public interface CacheGgfsPerBlockLruEvictionPolicyMBean {
+    /**
+     * Gets maximum allowed size of all blocks in bytes.
+     *
+     * @return Maximum allowed size of all blocks in bytes.
+     */
+    @IgniteMBeanDescription("Maximum allowed size of all blocks in bytes.")
+    public long getMaxSize();
+
+    /**
+     * Sets maximum allowed size of data in all blocks in bytes.
+     *
+     * @param maxSize Maximum allowed size of data in all blocks in bytes.
+     */
+    @IgniteMBeanDescription("Sets aximum allowed size of data in all blocks in bytes.")
+    public void setMaxSize(long maxSize);
+
+    /**
+     * Gets maximum allowed amount of blocks.
+     *
+     * @return Maximum allowed amount of blocks.
+     */
+    @IgniteMBeanDescription("Maximum allowed amount of blocks.")
+    public int getMaxBlocks();
+
+    /**
+     * Sets maximum allowed amount of blocks.
+     *
+     * @param maxBlocks Maximum allowed amount of blocks.
+     */
+    @IgniteMBeanDescription("Sets maximum allowed amount of blocks.")
+    public void setMaxBlocks(int maxBlocks);
+
+    /**
+     * Gets collection of regex for paths whose blocks must not be evicted.
+     *
+     * @return Collection of regex for paths whose blocks must not be evicted.
+     */
+    @IgniteMBeanDescription("Collection of regex for paths whose blocks must not be evicted.")
+    @Nullable public Collection<String> getExcludePaths();
+
+    /**
+     * Sets collection of regex for paths whose blocks must not be evicted.
+     *
+     * @param excludePaths Collection of regex for paths whose blocks must not be evicted.
+     */
+    @IgniteMBeanDescription("Sets collection of regex for paths whose blocks must not be evicted.")
+    public void setExcludePaths(@Nullable Collection<String> excludePaths);
+
+    /**
+     * Gets current size of data in all blocks.
+     *
+     * @return Current size of data in all blocks.
+     */
+    @IgniteMBeanDescription("Current size of data in all blocks.")
+    public long getCurrentSize();
+
+    /**
+     * Gets current amount of blocks.
+     *
+     * @return Current amount of blocks.
+     */
+    @IgniteMBeanDescription("Current amount of blocks.")
+    public int getCurrentBlocks();
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafee25f/modules/core/src/main/java/org/apache/ignite/cache/eviction/ggfs/GridCacheGgfsEvictionFilter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/ggfs/GridCacheGgfsEvictionFilter.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/ggfs/GridCacheGgfsEvictionFilter.java
deleted file mode 100644
index 3e89405..0000000
--- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/ggfs/GridCacheGgfsEvictionFilter.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.cache.eviction.ggfs;
-
-import org.apache.ignite.cache.*;
-import org.apache.ignite.cache.eviction.*;
-import org.apache.ignite.internal.processors.fs.*;
-
-/**
- * GGFS eviction filter which will not evict blocks of particular files.
- */
-public class GridCacheGgfsEvictionFilter implements GridCacheEvictionFilter {
-    /** {@inheritDoc} */
-    @Override public boolean evictAllowed(GridCacheEntry entry) {
-        Object key = entry.getKey();
-
-        return !(key instanceof GridGgfsBlockKey && ((GridGgfsBlockKey)key).evictExclude());
-    }
-}


Mime
View raw message