Thanks for reply.

Our clients are connected in both ways one is JCache way and other is SQL
way each for various caches.

-> For get/put we use normal getAll() and normal putAll(). The thing is here
all the threads will have their own data and the data is not shared. So no
need to worry about data consistency here.

-> For SQL, we are using java thin client. I'll share a sample code on how
we are doing it. Please check below code.
 
```
IgniteSemaphore semaphore = null;
                    try {
                        semaphore =
cacheHolder.getJDBCSemaphore(IgniteLocks.JDBC_LOCK.getLockValue());
                        semaphore.acquire();
                        try{
                           
Class.forName("org.apache.ignite.IgniteJdbcThinDriver");
                        }
                        catch(Exception e) {
                            e.printStackTrace();
                        }
                        try(final Connection conn =
DriverManager.getConnection(IgniteCacheTable.JDBC_THIN_URL_STRING.toString())){
                            try (final Statement stmt =
conn.createStatement()) {
                                stmt.executeUpdate("SET STREAMING ON
ALLOW_OVERWRITE ON");//No I18N
                            }
                            try(final PreparedStatement stmt =
conn.prepareStatement(
                                    "INSERT INTO URLS VALUES (?, ?, ?, ?)"))
{//No I18N
                                while (keys.hasNext()) {
                                    String key = keys.next().toString();
                                    s_id = cacheHolder.getAtomicSequence();
                                    stmt.setLong(1, s_id);
                                    stmt.setString(2, key);
                                    stmt.setDouble(3,
Double.parseDouble(keyValueMap.get(key).toString()));
                                    stmt.setLong(4, appNameId);
                                    stmt.execute();
                                   
appNameUrl.put(IgniteCacheTable.FRONTIER_DB.getDBValue()+"|"+objects[1]+"|"+key,
s_id);
                                }
                            }
                        }
                    }
                    finally {
                        if(semaphore != null){
                            semaphore.release();
                        }
                    }
```


All these queries will be made simultaneously within the App servers.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Reply via email to