fr.fastconnect.gigaspaces.datasource
Class CompositeBulkDataPersister<T>

java.lang.Object
  extended by fr.fastconnect.gigaspaces.datasource.CompositeBulkDataPersister<T>
Type Parameters:
T -
All Implemented Interfaces:
com.gigaspaces.datasource.BulkDataPersister, com.gigaspaces.datasource.ManagedDataSource<T>

public class CompositeBulkDataPersister<T>
extends java.lang.Object
implements com.gigaspaces.datasource.BulkDataPersister, com.gigaspaces.datasource.ManagedDataSource<T>

Provides the capacity to use several implementation of BulkDataPersister using a Mirror.


Field Summary
static java.lang.String BULK_DATA_PERSISTER_CLASS_NAMES_DELIMITER_PROPERTY
           
static java.lang.String BULK_DATA_PERSISTER_CLASS_NAMES_PROPERTY
           
static java.lang.String BULK_DATA_PERSISTER_EXECUTION_EXCEPTION_STRATEGY_CLASS_NAME_PROPERTY
           
 
Fields inherited from interface com.gigaspaces.datasource.ManagedDataSource
DATA_CLASS_PROPS, NUMBER_OF_PARTITIONS, STATIC_PARTITION_NUMBER
 
Constructor Summary
CompositeBulkDataPersister()
           
CompositeBulkDataPersister(com.gigaspaces.datasource.BulkDataPersister[] bulkDataPersisterDelegates)
           
 
Method Summary
 void executeBulk(java.util.List<com.gigaspaces.datasource.BulkItem> bulkItems)
          
protected  java.util.concurrent.ExecutorService getExecutorService()
          Constructs the ExecutorService implementation used to execute concurrently all BulkDataPersister delegates.
protected  void handleUnrecoverableException(com.gigaspaces.datasource.BulkDataPersister bulkDataPersister, java.util.List<com.gigaspaces.datasource.BulkItem> bulkItems, java.lang.Exception exception)
          Last chance to handle an exception thrown by BulkDataPersister.executeBulk(List).
 void init(java.util.Properties properties)
          
 com.gigaspaces.datasource.DataIterator<T> initialLoad()
          
 void setExecutionFailureStrategy(ExecutionFailureStrategy executionFailureStrategy)
           
 void shutdown()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BULK_DATA_PERSISTER_CLASS_NAMES_PROPERTY

public static final java.lang.String BULK_DATA_PERSISTER_CLASS_NAMES_PROPERTY
See Also:
Constant Field Values

BULK_DATA_PERSISTER_CLASS_NAMES_DELIMITER_PROPERTY

public static final java.lang.String BULK_DATA_PERSISTER_CLASS_NAMES_DELIMITER_PROPERTY
See Also:
Constant Field Values

BULK_DATA_PERSISTER_EXECUTION_EXCEPTION_STRATEGY_CLASS_NAME_PROPERTY

public static final java.lang.String BULK_DATA_PERSISTER_EXECUTION_EXCEPTION_STRATEGY_CLASS_NAME_PROPERTY
See Also:
Constant Field Values
Constructor Detail

CompositeBulkDataPersister

public CompositeBulkDataPersister()

CompositeBulkDataPersister

public CompositeBulkDataPersister(com.gigaspaces.datasource.BulkDataPersister[] bulkDataPersisterDelegates)
Method Detail

init

public void init(java.util.Properties properties)
          throws com.gigaspaces.datasource.DataSourceException

Specified by:
init in interface com.gigaspaces.datasource.ManagedDataSource<T>
Throws:
com.gigaspaces.datasource.DataSourceException

initialLoad

public com.gigaspaces.datasource.DataIterator<T> initialLoad()
                                                      throws com.gigaspaces.datasource.DataSourceException

Specified by:
initialLoad in interface com.gigaspaces.datasource.ManagedDataSource<T>
Throws:
com.gigaspaces.datasource.DataSourceException

executeBulk

public void executeBulk(java.util.List<com.gigaspaces.datasource.BulkItem> bulkItems)
                 throws com.gigaspaces.datasource.DataSourceException

Specified by:
executeBulk in interface com.gigaspaces.datasource.BulkDataPersister
Throws:
com.gigaspaces.datasource.DataSourceException

getExecutorService

protected java.util.concurrent.ExecutorService getExecutorService()
Constructs the ExecutorService implementation used to execute concurrently all BulkDataPersister delegates. Called each time executeBulk(List) is called.

Default implementation returns a ThreadPoolExecutor using one named thread (CompositeBulkDataPersisterThread-X) per BulkDataPersister delegate.

Returns:
the executorService

handleUnrecoverableException

protected void handleUnrecoverableException(com.gigaspaces.datasource.BulkDataPersister bulkDataPersister,
                                            java.util.List<com.gigaspaces.datasource.BulkItem> bulkItems,
                                            java.lang.Exception exception)
                                     throws com.gigaspaces.datasource.DataSourceException
Last chance to handle an exception thrown by BulkDataPersister.executeBulk(List).

Is called when: -exception thrown is a DataSourceException and provided execution exception strategy throws an exception -exception thrown is a DataSourceException and there is no provided execution exception strategy -exception thrown is not a DataSourceException
Is NOT called when: -exception thrown is a DataSourceException and provided execution exception strategy DOES NOT throw an exception

Default implementation use a ObjectOutputStream to dump bulkItems.

Parameters:
bulkDataPersister - the persister used
bulkItems - the information received
exception - the exception generated by BulkDataPersister.executeBulk(List)
Throws:
com.gigaspaces.datasource.DataSourceException - if thrown propagated to mirror which triggers redo-log mechanism

shutdown

public void shutdown()
              throws com.gigaspaces.datasource.DataSourceException

Specified by:
shutdown in interface com.gigaspaces.datasource.ManagedDataSource<T>
Throws:
com.gigaspaces.datasource.DataSourceException

setExecutionFailureStrategy

public void setExecutionFailureStrategy(ExecutionFailureStrategy executionFailureStrategy)


Copyright © 2007-2009 FastConnect. All Rights Reserved.