Comments (3)
I'm happy to contribute a fix for it - please let me know how I can do that.
from ff4j.
Simple test to support this jira
package org.ff4j.test.strategy;
/*-
* #%L
* ff4j-core
* %%
* Copyright (C) 2013 - 2023 FF4J
* %%
* 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
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.ff4j.strategy.time.ReleaseDateFlipStrategy;
import org.junit.Test;
import java.text.ParseException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import static org.ff4j.strategy.time.ReleaseDateFlipStrategy.PARAMNAME_RELEASEDATE;
import static org.junit.Assert.assertEquals;
import static org.junit.runners.model.MultipleFailureException.assertEmpty;
/**
* Testing class for {@link ReleaseDateFlipStrategy} class.
*
* @author Henry Naftulin
*/
public class ReleaseDateFlipStrategyMultiThreadTest {
protected final Log logger = LogFactory.getLog(getClass());
public static String[] validDates = {
"2023-01-01-10:22",
"2023-01-01-10:23",
"2023-01-01-10:24",
"2023-01-01-10:25",
"2023-01-01-10:26",
"2023-01-01-10:27"
};
int numThreads = 40;
private static CountDownLatch latch;
private List<FeatureDateRunnable> runnables = new ArrayList<>();
private static List<String> errors = new ArrayList<>();
@Test
public void testMultipleThreads() throws ParseException, InterruptedException {
for(int i=0; i<numThreads; i++) {
runnables.add(new FeatureDateRunnable(validDates[i%validDates.length]));
}
latch = new CountDownLatch(numThreads);
for(Runnable r : runnables) {
new Thread(r).start();
}
latch.await();
logger.info("Ran "+ numThreads + " trials, got errors in " + errors.size() + " trials");
assertEquals(new ArrayList<>(), errors);
}
static class FeatureDateRunnable implements Runnable {
protected final Log logger = LogFactory.getLog(getClass());
private String strDate;
public FeatureDateRunnable(String strDate) {
this.strDate = strDate;
}
public void run() {
try {
ReleaseDateFlipStrategy strategy = new ReleaseDateFlipStrategy(strDate);
} catch(Throwable t) {
String message = "Exception thrown when creating ReleaseDateFlipStrategy with date: " + strDate;
errors.add(message);
logger.error(message, t);
} finally {
latch.countDown();
}
}
}
}
from ff4j.
Pull request created: #707
from ff4j.
Related Issues (20)
- YamlParser is not exporting property description [Bug]
- YamlParser should not print configuration to the standard out when export is called
- Support Redis client side caching
- Thymeleaf deprecation warnings
- Support environmental variables for dynamo db client
- [Bug]Accessing the rest api? HOT 4
- [Bug] Using a pooling data source (example PoolingDataSourceImpl) with audit enabled, after you create a property you cannot update it HOT 1
- how to pass custom parameters to custom flip strategy HOT 2
- Ff4j client with spring boot 3.x HOT 8
- Notification of toggle activation/decativation over communication channels HOT 2
- [Bug] org.ff4j ยป ff4j-spring-boot-starter 2.0.0 is not available in maven central HOT 3
- How can I customize the ui of web console including logo and header ? HOT 1
- Upgrade from 1.8.12 to 1.8.13 Breaks Deployment of War to WebSphere
- Feature toggle state change evicts from cache but doesn't cache new state HOT 1
- [New Feature] Jedis 4 compatibility
- [New Feature] PostgreSQL compatibility HOT 2
- [Bug] Can I set Web Console content path to "/" ?
- Can't secure console using Spring Security HOT 1
- FF4j SpringDoc Conflicts HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ff4j.