@Override public Status scan(String table, String startkey, int recordcount, Set<String> fields, Vector<HashMap<String, ByteIterator>> result) { LOGGER.warn("Infinispan does not support scan semantics"); return Status.NOT_IMPLEMENTED; }
@Override public Status delete(String table, String recordKey) { String compositKey = createKey(table, recordKey); try { cache().remove(compositKey); return Status.OK; } catch (Exception e) { LOGGER.error(e); return Status.ERROR; } }
@Override public void run() { boolean interrupted = !doPurge(bucketFile); if (interrupted) log.debug("Interrupted, so finish work."); } });
public MapStressTest() { log.tracef("MapStressTest configuration: capacity %d, test running time %d seconds\n", CAPACITY, RUNNING_TIME / 1000); }
@Override public void run() { log.trace("This is a runnable!"); } }
private void log(String method, String msg) { log.debugf("Worker[%s, unlock? %s] %s %s", index, withUnlock, method, msg); }
private int checkForeignIdLimit(int id, AdvancedExternalizer<?> ext) { if (id < 0) throw log.foreignExternalizerUsingNegativeId(ext, id); return id; }
private int checkInternalIdLimit(int id, AdvancedExternalizer<?> ext) { if (id >= MAX_ID) throw log.internalExternalizerIdLimitExceeded(ext, id, MAX_ID); return id; }
@Override public Status insert(String table, String recordKey, Map<String, ByteIterator> values) { String compositKey = createKey(table, recordKey); Map<String, String> stringValues = new HashMap<>(); StringByteIterator.putAllAsStrings(stringValues, values); try { cache().put(compositKey, stringValues); return Status.OK; } catch (Exception e) { LOGGER.error(e); return Status.ERROR; } }
private void setResponse(Object e) { log.tracef("setResponse to %s", e); response = e; }
@Override public Void call() throws Exception { waitForClusterToForm(); log.debug("3rd has join"); return null; } });
public Status scan(String table, String startkey, int recordcount, Set<String> fields, Vector<HashMap<String, ByteIterator>> result) { LOGGER.warn("Infinispan does not support scan semantics"); return Status.OK; }
@Override public Status update(String table, String recordKey, Map<String, ByteIterator> values) { String compositKey = createKey(table, recordKey); try { Map<String, String> stringValues = new HashMap<>(); StringByteIterator.putAllAsStrings(stringValues, values); cache().put(compositKey, stringValues); return Status.OK; } catch (Exception e) { LOGGER.error(e); return Status.ERROR; } }
private void print(String s) { log.debug(s); } }
@Override public Status read(String table, String recordKey, Set<String> fields, Map<String, ByteIterator> result) { String compositKey = createKey(table, recordKey); try { Map<String, String> values = cache().get(compositKey); if (values == null || values.isEmpty()) { return Status.NOT_FOUND; } if (fields == null) { //get all field/value pairs StringByteIterator.putAllAsByteIterators(result, values); } else { for (String field : fields) { String value = values.get(field); if (value != null) { result.put(field, new StringByteIterator(value)); } } } return Status.OK; } catch (Exception e) { LOGGER.error(e); return Status.ERROR; } }
private void print(Object value) { log.debug(value); }
public Status delete(String table, String key) { try { if (clustered) { AtomicMapLookup.removeAtomicMap(infinispanManager.getCache(table), key); } else { infinispanManager.getCache(table).remove(key); } return Status.OK; } catch (Exception e) { LOGGER.error(e); return Status.ERROR; } } }
public Status read(String table, String key, Set<String> fields, Map<String, ByteIterator> result) { try { Map<String, String> row; if (clustered) { row = AtomicMapLookup.getAtomicMap(infinispanManager.getCache(table), key, false); } else { Cache<String, Map<String, String>> cache = infinispanManager.getCache(table); row = cache.get(key); } if (row != null) { result.clear(); if (fields == null || fields.isEmpty()) { StringByteIterator.putAllAsByteIterators(result, row); } else { for (String field : fields) { result.put(field, new StringByteIterator(row.get(field))); } } } return Status.OK; } catch (Exception e) { LOGGER.error(e); return Status.ERROR; } }
public Status insert(String table, String key, Map<String, ByteIterator> values) { try { if (clustered) { AtomicMap<String, String> row = AtomicMapLookup.getAtomicMap(infinispanManager.getCache(table), key); row.clear(); StringByteIterator.putAllAsStrings(row, values); } else { infinispanManager.getCache(table).put(key, values); } return Status.OK; } catch (Exception e) { LOGGER.error(e); return Status.ERROR; } }
public Status update(String table, String key, Map<String, ByteIterator> values) { try { if (clustered) { AtomicMap<String, String> row = AtomicMapLookup.getAtomicMap(infinispanManager.getCache(table), key); StringByteIterator.putAllAsStrings(row, values); } else { Cache<String, Map<String, String>> cache = infinispanManager.getCache(table); Map<String, String> row = cache.get(key); if (row == null) { row = StringByteIterator.getStringMap(values); cache.put(key, row); } else { StringByteIterator.putAllAsStrings(row, values); } } return Status.OK; } catch (Exception e) { LOGGER.error(e); return Status.ERROR; } }