[infinispan-issues] [JBoss JIRA] (ISPN-9451) When fail-silently is false, the system will behave based on persistence configuration
Diego Lovison (Jira)
issues at jboss.org
Thu Oct 4 08:22:00 EDT 2018
[ https://issues.jboss.org/browse/ISPN-9451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13643147#comment-13643147 ]
Diego Lovison commented on ISPN-9451:
-------------------------------------
[~ryanemerson] the database configuration is "jdbc:h2:~/test;FILE_LOCK=SOCKET" in this case, it will allow only one program to get the connection from the database. When you start the second Java App, you will see the following error in the console
{noformat}
com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: Database may be already in use: "Locked by another process". Possible solutions: close all other connection(s); use the server mode [90020-197]
{noformat}
The cache configuration for fail-silently=false. I am expecting that the second Java App to fail in the first time and not try 5 times.
> When fail-silently is false, the system will behave based on persistence configuration
> --------------------------------------------------------------------------------------
>
> Key: ISPN-9451
> URL: https://issues.jboss.org/browse/ISPN-9451
> Project: Infinispan
> Issue Type: Bug
> Reporter: Diego Lovison
> Assignee: Ryan Emerson
> Priority: Critical
>
> Using the configuration below when the store is not available, the system won't fail at the first time.
> {code:xml}
> <?xml version="1.0" ?>
> <infinispan>
> <jgroups>
> <stack-file name="external-file" path="default-jgroups-tcp.xml"/>
> </jgroups>
> <cache-container name="myCacheContainer" default-cache="myCache" statistics="true">
> <transport cluster="WeatherApp" stack="external-file" />
> <distributed-cache owners="2" mode="SYNC" remote-timeout="15000" name="myCache">
> <transaction mode="NONE"/>
> <persistence connection-attempts="5" connection-interval="2000">
> <string-keyed-jdbc-store fetch-state="false" purge="false" read-only="false" shared="true">
> <write-behind fail-silently="false" />
> <string-keyed-table prefix="ISPN_STRING_TABLE" create-on-start="true">
> <id-column name="ID_COLUMN" type="VARCHAR(255)"/>
> <data-column name="DATA_COLUMN" type="BINARY"/>
> <timestamp-column name="TIMESTAMP_COLUMN" type="BIGINT"/>
> </string-keyed-table>
> <connection-pool
> connection-url="jdbc:h2:~/test;FILE_LOCK=SOCKET"
> driver="org.h2.Driver" username="sa"/>
> </string-keyed-jdbc-store>
> </persistence>
> </distributed-cache>
> </cache-container>
> </infinispan>
> {code}
> To reproduce the issue, you should start the application twice.
> The first application will work fine. The second one will fail 5 times before stops working.
> The fail-silently is "false" so it should fail at the first time.
> {code:java}
> public class ConfigurationFileCacheExample {
> public static void main(String[] args) throws InterruptedException, IOException {
> EmbeddedCacheManager cacheManager = new DefaultCacheManager("cache-jdbc-store.xml");
> try {
> Cache<String, LocationWeather> cache = cacheManager.getCache("weather");
> System.out.println(cache.size());
> while (true) {
> String location = UUID.randomUUID().toString();
> cache.put(location, new LocationWeather(37, location));
> TimeUnit.SECONDS.sleep(1);
> }
> } finally {
> cacheManager.stop();
> }
> }
> }
> {code}
>
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
More information about the infinispan-issues
mailing list