View Javadoc

1   /*
2    * Copyright 2008 fastConnect.
3    *    
4    * This file is part of Composite BulkDataPersister.  
5    *
6    * This is free software; you can redistribute it and/or modify it
7    * under the terms of the GNU Lesser General Public License as
8    * published by the Free Software Foundation; either version 3 of
9    * the License, or (at your option) any later version.
10   *
11   * This software is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14   * Lesser General Public License for more details.
15   *
16   * You should have received a copy of the GNU Lesser General Public
17   * License along with this software. If not, see <http://www.gnu.org/licenses/>.
18   */
19  package fr.fastconnect.gigaspaces.datasource;
20  
21  import java.util.List;
22  import java.util.Properties;
23  
24  import com.gigaspaces.datasource.BulkDataPersister;
25  import com.gigaspaces.datasource.BulkItem;
26  import com.gigaspaces.datasource.DataSourceException;
27  
28  /**
29   *Defines a mechanism allowing to handle failure to delegate to a particular {@link BulkDataPersister#executeBulk(List)} implementation.
30   */
31  public interface ExecutionFailureStrategy {
32  
33  	/**
34  	 * Allows the {@link ExecutionFailureStrategy} to be configured using the {@link Properties} object from {@link com.gigaspaces.datasource.ManagedDataSource.ManagedDataSource#init(Properties)}.
35  	 * 
36  	 * @param properties the {@link Properties} received by {@link com.gigaspaces.datasource.ManagedDataSource.ManagedDataSource#init(Properties)}
37  	 * @throws DataSourceException if thrown is propagated to {@link com.gigaspaces.datasource.ManagedDataSource.ManagedDataSource#init(Properties)}
38  	 */
39  	void init(Properties properties) throws DataSourceException;
40  	
41  	/**
42  	 * Deals with the {@link DataException} thrown by a {@link BulkDataPersister#executeBulk(List)}.
43  	 * <br />
44  	 * If this method itself throws an exception then we delegate the call to {@link CompositeBulkDataPersister#handleUnrecuperableException(BulkDataPersister, List)}.
45  	 * 
46  	 * @param bulkDataPersister the persister used
47  	 * @param bulkItems the information received
48  	 * @param exception the {@link Exception} thrown by the {@link BulkDataPersister#executeBulk(List)} execution.
49  	 * @throws Exception delegates failure to {@link CompositeBulkDataPersister#handleUnrecuperableException(BulkDataPersister, List)}
50  	 */
51  	void handleExecutionFailure(BulkDataPersister bulkDataPersister, List<BulkItem> bulkItems, DataSourceException exception) throws Exception;
52  	
53  }