This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET HTTP_PROXY=http://%USER%:%PASSWORD%@%SERVER%:%PORT% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AsyncTaskExecutorFactory { | |
... | |
public static SimpleAsyncTaskExecutor createInstance() { | |
SimpleAsyncTaskExecutor instance = new SimpleAsyncTaskExecutor(); | |
// set concurrencyLimit according to available processors | |
// real simple 1:1 relation | |
Runtime runtime = Runtime.getRuntime(); | |
int nrCpu = runtime.availableProcessors(); | |
instance.setConcurrencyLimit(nrCpu); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class JdbcPagingItemReaderTests { | |
private BasicDataSource dataSource; | |
public void setUp() throws Exception { | |
// DataSource Setup, apache commons | |
dataSource = new BasicDataSource(); | |
dataSource.setDriverClassName("org.hsqldb.jdbcDriver"); | |
dataSource.setUrl("jdbc:hsqldb:mem:testdb"); | |
dataSource.setUsername("sa"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* CustomSqlParameterSourceProvider, constructs {@link MapSqlParameterSource} with | |
* given item. | |
* | |
* @author Michael R. Lange <[email protected]> | |
*/ | |
public class CustomSqlParameterSourceProvider implements ItemSqlParameterSourceProvider<YourItemObject> { | |
@Override | |
public SqlParameterSource createSqlParameterSource(final YourItemObject item) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implementation for {@link ItemSqlParameterSourceProvider}, | |
* creates {@link MapSqlParameterSource} from {@link FieldSet}. | |
* | |
* @author Michael R. Lange <[email protected]> | |
*/ | |
public class FieldSetSqlParameterSourceProvider implements ItemSqlParameterSourceProvider<FieldSet> { | |
/** {@inheritDoc} */ | |
@Override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class WrappedMrirToGetCurrentResource<T> implements ItemStreamReader<T> { | |
private MultiResourceItemReader<T> mrir; | |
@Override | |
public void open(ExecutionContext executionContext) throws ItemStreamException { | |
mrir.open(executionContext); | |
// current.resource is only available here if it's a restart | |
if (mrir.getCurrentResource() != null && mrir.getCurrentResource().getFilename() != null) { | |
System.out.println("open:" + mrir.getCurrentResource().getFilename()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from http://www.techper.net/2009/06/05/how-to-acess-target-object-behind-a-spring-proxy/ | |
@SuppressWarnings({"unchecked"}) | |
protected <T> T getTargetObject(Object proxy, Class<T> targetClass) throws Exception { | |
if (AopUtils.isJdkDynamicProxy(proxy)) { | |
return (T) ((Advised)proxy).getTargetSource().getTarget(); | |
} else { | |
return (T) proxy; // expected to be cglib proxy then, which is simply a specialized class | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright 2012 Michael R. Lange <[email protected]>. | |
* | |
* Licensed 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright 2012 Michael R. Lange <[email protected]>. | |
* | |
* Licensed 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.List; | |
import org.springframework.batch.item.ExecutionContext; | |
import org.springframework.batch.item.ItemStream; | |
import org.springframework.batch.item.ItemStreamException; | |
import org.springframework.batch.item.ItemStreamReader; | |
import org.springframework.batch.item.NonTransientResourceException; | |
import org.springframework.batch.item.ParseException; | |
import org.springframework.batch.item.UnexpectedInputException; |
OlderNewer