Search in sources :

Example 1 with ReloadableStore

use of io.seata.server.storage.file.ReloadableStore in project seata by seata.

the class WriteStoreTest method readAll.

private static Map<SessionStorable, LogOperation> readAll(TransactionStoreManager transactionStoreManager) {
    Map<SessionStorable, LogOperation> resultMap = new HashMap<>(65535 * 5 * 9);
    while (((ReloadableStore) transactionStoreManager).hasRemaining(true)) {
        List<TransactionWriteStore> transactionWriteStores = ((ReloadableStore) transactionStoreManager).readWriteStore(2000, true);
        if (transactionWriteStores != null) {
            for (TransactionWriteStore transactionWriteStore : transactionWriteStores) {
                printLog(transactionWriteStore);
                resultMap.put(transactionWriteStore.getSessionRequest(), transactionWriteStore.getOperate());
            }
        }
    }
    while (((ReloadableStore) transactionStoreManager).hasRemaining(false)) {
        List<TransactionWriteStore> transactionWriteStores = ((ReloadableStore) transactionStoreManager).readWriteStore(2000, false);
        if (transactionWriteStores != null) {
            for (TransactionWriteStore transactionWriteStore : transactionWriteStores) {
                printLog(transactionWriteStore);
                resultMap.put(transactionWriteStore.getSessionRequest(), transactionWriteStore.getOperate());
            }
        }
    }
    return resultMap;
}
Also used : LogOperation(io.seata.server.store.TransactionStoreManager.LogOperation) HashMap(java.util.HashMap) TransactionWriteStore(io.seata.server.storage.file.TransactionWriteStore) SessionStorable(io.seata.server.store.SessionStorable) ReloadableStore(io.seata.server.storage.file.ReloadableStore)

Aggregations

ReloadableStore (io.seata.server.storage.file.ReloadableStore)1 TransactionWriteStore (io.seata.server.storage.file.TransactionWriteStore)1 SessionStorable (io.seata.server.store.SessionStorable)1 LogOperation (io.seata.server.store.TransactionStoreManager.LogOperation)1 HashMap (java.util.HashMap)1