## org.hibernate.cache.infinispan.impl
Class BaseRegion

    java.lang.Object
      org.hibernate.cache.infinispan.impl.BaseRegion

All Implemented Interfaces:
  Region

Direct Known Subclasses:
  BaseGeneralDataRegion, BaseTransactionalDataRegion

    public abstract class BaseRegion

extends Object
implements Region

Support for Infinispan `Region`s. Handles common "utility" methods for an underlying named Cache. In other words, this implementation doesn't actually read or write data. Subclasses are expected to provide core cache interaction appropriate to the semantics needed.

Since:
  3.5
Author:
  Chris Bredesen, Galder Zamarreño

Field Summary
`protected AddressAdapter` `address`
`protected CacheAdapter` `cacheAdapter`
`protected Set<AddressAdapter>` `currentView`
`protected AtomicReference<org.hibernate.cache.infinispan.impl.BaseRegion.InvalidateState>` `invalidateState`
`protected Object` `invalidationMutex`
`protected boolean` `replication`
`protected TransactionManager` `transactionManager`

Constructor Summary
`BaseRegion(CacheAdapter cacheAdapter, String name, TransactionManager transactionManager, RegionFactory factory)`

Method Summary
`boolean` `checkValid()`
`boolean` `contains(Object key)` Determine whether this region contains data for the given key.
`void` `destroy()` The "end state" contract of the region's lifecycle.
`void` `entryInvalidated(org.infinispan.notifications.cachelistener.event.CacheEntryInvalidatedEvent event)`
`void` `entryModified(org.infinispan.notifications.cachelistener.event.CacheEntryModifiedEvent event)`
`protected Object` `get(Object key, boolean suppressTimeout, FlagAdapter... flagAdapters)` Performs a Infinispan `get(Fqn, Object)`
`AddressAdapter` `getAddress()`
`CacheAdapter` `getCacheAdapter()`
`long` `getElementCountInMemory()` The count of entries currently contained in the regions in-memory store.
`long` `getElementCountOnDisk()` Not supported.
`String` `getName()` Retrieve the name of this region.
`Object` `getOwnerForPut()`
`long` `getSizeInMemory()` Not supported.
`int` `getTimeout()`
`protected boolean` `handleEvictAllInvalidation(org.infinispan.notifications.cachelistener.event.CacheEntryInvalidatedEvent event)`
`protected boolean` `handleEvictAllModification(org.infinispan.notifications.cachelistener.event.CacheEntryModifiedEvent event)`
`protected boolean` `isValid()`
`long` `nextTimestamp()`
`void` `resume(Transaction tx)` Tell the TransactionManager to resume the given transaction
`void` `start()`
`Transaction` `suspend()` Tell the TransactionManager to suspend any ongoing transaction.
`Map` `toMap()` Get the contents of this region as a map.
`void` `viewChanged(org.infinispan.notifications.cachemanagerlistener.event.ViewChangedEvent event)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### cacheAdapter

    protected final CacheAdapter cacheAdapter

### address

    protected final AddressAdapter address

### currentView

    protected final Set<AddressAdapter> currentView

### transactionManager

    protected final TransactionManager transactionManager

### replication

    protected final boolean replication

### invalidationMutex

    protected final Object invalidationMutex

### invalidateState

    protected final AtomicReference<org.hibernate.cache.infinispan.impl.BaseRegion.InvalidateState> invalidateState

Constructor Detail

### BaseRegion

    public BaseRegion(CacheAdapter cacheAdapter,
                      String name,
                      TransactionManager transactionManager,
                      RegionFactory factory)

Method Detail

### start

    public void start()

### getName

    public String getName()

  Description copied from interface: `Region`
  Retrieve the name of this region.

  Specified by:
    `getName` in interface `Region`
  Returns:
    The region name

### getCacheAdapter

    public CacheAdapter getCacheAdapter()

### getElementCountInMemory

    public long getElementCountInMemory()

  Description copied from interface: `Region`
  The count of entries currently contained in the regions in-memory store.

  Specified by:
    `getElementCountInMemory` in interface `Region`
  Returns:
    The count of entries in memory; -1 if unknown or unsupported.

### getElementCountOnDisk

    public long getElementCountOnDisk()

  Not supported.

  Specified by:
    `getElementCountOnDisk` in interface `Region`
  Returns:
    -1

### getSizeInMemory

    public long getSizeInMemory()

  Not supported.

  Specified by:
    `getSizeInMemory` in interface `Region`
  Returns:
    -1

### getTimeout

    public int getTimeout()

  Specified by:
    `getTimeout` in interface `Region`

### nextTimestamp

    public long nextTimestamp()

  Specified by:
    `nextTimestamp` in interface `Region`

### toMap

    public Map toMap()

  Description copied from interface: `Region`
  Get the contents of this region as a map.

  Implementors which do not support this notion should simply return an empty map.

  Specified by:
    `toMap` in interface `Region`
  Returns:
    The content map.

### destroy

    public void destroy()
                 throws CacheException

  Description copied from interface: `Region`
  The "end state" contract of the region's lifecycle. Called during `SessionFactory.close()` to give the region a chance to cleanup.

  Specified by:
    `destroy` in interface `Region`
  Throws:
    `CacheException` - Indicates problem shutting down

### contains

    public boolean contains(Object key)

  Description copied from interface: `Region`
  Determine whether this region contains data for the given key.

  The semantic here is whether the cache contains data visible for the current call context. This should be viewed as a "best effort", meaning blocking should be avoid if possible.

  Specified by:
    `contains` in interface `Region`
  Parameters:
    `key` - The cache key
  Returns:
    True if the underlying cache contains corresponding data; false otherwise.

### getAddress

    public AddressAdapter getAddress()

### checkValid

    public boolean checkValid()

### isValid

    protected boolean isValid()

### get

    protected Object get(Object key,
                         boolean suppressTimeout,
                         FlagAdapter... flagAdapters)
                  throws CacheException

  Performs a Infinispan `get(Fqn, Object)`

  Parameters:
    `key` - The key of the item to get
    `suppressTimeout` - should any TimeoutException be suppressed?
    `flagAdapters` - flags to add to the get invocation
  Returns:
    The retrieved object
  Throws:
    `CacheException` - issue managing transaction or talking to cache

### getOwnerForPut

    public Object getOwnerForPut()

### suspend

    public Transaction suspend()

  Tell the TransactionManager to suspend any ongoing transaction.

  Returns:
    the transaction that was suspended, or `null` if there wasn't one

### resume

    public void resume(Transaction tx)

  Tell the TransactionManager to resume the given transaction

  Parameters:
    `tx` - the transaction to suspend. May be `null`.

### entryModified

    public void entryModified(org.infinispan.notifications.cachelistener.event.CacheEntryModifiedEvent event)

### handleEvictAllModification

    protected boolean handleEvictAllModification(org.infinispan.notifications.cachelistener.event.CacheEntryModifiedEvent event)

### entryInvalidated

    public void entryInvalidated(org.infinispan.notifications.cachelistener.event.CacheEntryInvalidatedEvent event)

### handleEvictAllInvalidation

    protected boolean handleEvictAllInvalidation(org.infinispan.notifications.cachelistener.event.CacheEntryInvalidatedEvent event)

### viewChanged

    public void viewChanged(org.infinispan.notifications.cachemanagerlistener.event.ViewChangedEvent event)

Copyright © 2001-2010 Red Hat, Inc. All Rights Reserved.