com.hazelcast.web
Class ReferenceSessionEntryProcessor

java.lang.Object
  extended by com.hazelcast.map.AbstractEntryProcessor<String,T>
      extended by com.hazelcast.web.AbstractWebDataEntryProcessor<Integer>
          extended by com.hazelcast.web.ReferenceSessionEntryProcessor
All Implemented Interfaces:
EntryProcessor<String,Integer>, DataSerializable, IdentifiedDataSerializable, Serializable

public class ReferenceSessionEntryProcessor
extends AbstractWebDataEntryProcessor<Integer>

Increments the reference count, returning Boolean.FALSE if the entry does not exist and Boolean.TRUE otherwise.

This EntryProcessor is intended to be used to check whether a session is known to the cluster in preparation to create a local "copy". When Boolean.FALSE is returned, it means the session is not known and a new session should be created. Otherwise, if the entry already exists, the reference count is incremented and Boolean.TRUE is returned to indicate a "copy" should be made.

Since:
3.3
See Also:
Serialized Form

Constructor Summary
ReferenceSessionEntryProcessor()
           
 
Method Summary
 int getId()
          Returns type identifier for this class.
 Object process(Map.Entry<String,Integer> entry)
          Process the entry without worrying about concurrency.
 
Methods inherited from class com.hazelcast.web.AbstractWebDataEntryProcessor
getFactoryId, readData, writeData
 
Methods inherited from class com.hazelcast.map.AbstractEntryProcessor
getBackupProcessor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReferenceSessionEntryProcessor

public ReferenceSessionEntryProcessor()
Method Detail

getId

public int getId()
Description copied from interface: IdentifiedDataSerializable
Returns type identifier for this class. Id should be unique per DataSerializableFactory.

Returns:
type id

process

public Object process(Map.Entry<String,Integer> entry)
Description copied from interface: EntryProcessor
Process the entry without worrying about concurrency.

Note that to modify an entry by using EntryProcessor you should explicitly call Map.Entry.setValue(V) method of Map.Entry such as:

 
 Override
        public Object process(Map.Entry entry) {
          Value value = entry.getValue();
          // process and modify value
          // ...
          entry.setValue(value);
          return result;
        }
 
 
otherwise EntryProcessor does not guarantee to modify the entry.

Parameters:
entry - entry to be processed
Returns:
result of the process


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.