private ClusteredQueryCommand(ClusteredQueryCommandType type, String cacheName) { super(ByteString.fromString(cacheName)); commandType = type; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj.getClass() != ClusteredQueryCommand.class) return false; ClusteredQueryCommand other = (ClusteredQueryCommand) obj; return (cacheName == null ? other.cacheName == null : cacheName.equals(other.cacheName)) && (queryDefinition == null ? other.queryDefinition == null : queryDefinition.equals(other.queryDefinition)); }
public void inject(EmbeddedCacheManager cacheManager) { this.cache = cacheManager.<byte[], byte[]>getCache(cacheName.toString()).getAdvancedCache(); } }
public void testEmptyString() throws Exception { ByteString byteString = ByteString.fromString(""); assertSame(ByteString.emptyString(), byteString); ExposedByteArrayOutputStream outputStream = new ExposedByteArrayOutputStream(); try (ObjectOutput output = new ObjectOutputStream(outputStream)) { ByteString.writeObject(output, byteString); } ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.getRawBuffer()); try (ObjectInput input = new ObjectInputStream(inputStream)) { ByteString byteString2 = ByteString.readObject(input); assertSame(ByteString.emptyString(), byteString2); } }
public void testShortString() throws Exception { ByteString byteString = ByteString.fromString("abc"); ExposedByteArrayOutputStream outputStream = new ExposedByteArrayOutputStream(); try (ObjectOutput output = new ObjectOutputStream(outputStream)) { ByteString.writeObject(output, byteString); } ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.getRawBuffer()); try (ObjectInput input = new ObjectInputStream(inputStream)) { ByteString byteString2 = ByteString.readObject(input); assertEquals(byteString, byteString2); } }
@Override public int hashCode() { int result = 31 + (cacheName == null ? 0 : cacheName.hashCode()); return 31 * result + (queryDefinition == null ? 0 : queryDefinition.hashCode()); }
@Override public ClusteredLockKey readObject(ObjectInput input) throws IOException, ClassNotFoundException { return new ClusteredLockKey(ByteString.readObject(input)); } }
@Override public void writeObject(ObjectOutput output, ClusteredLockKey object) throws IOException { ByteString.writeObject(output, object.name); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((cacheName == null) ? 0 : cacheName.hashCode()); result = prime * result + ((query == null) ? 0 : query.hashCode()); return result; }
public static CacheXid readFrom(ObjectInput input) throws IOException { return new CacheXid(ByteString.readObject(input), XidImpl.readFrom(input)); }
public static void writeTo(ObjectOutput output, CacheXid object) throws IOException { ByteString.writeObject(output, object.cacheName); XidImpl.writeTo(output, object.xid); }
private ClusteredQueryCommand(CQCommandType commandType, String cacheName) { super(ByteString.fromString(cacheName)); this.commandType = commandType; }
@Override public void fetchExecutionContext(CommandInitializer ci) { this.cache = ci.getCacheManager().getCache(cacheName.toString()); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ClusteredLockKey that = (ClusteredLockKey) o; return name.equals(that.name); }
@Override public int hashCode() { int result = cacheName != null ? cacheName.hashCode() : 0; result = 31 * result + (keys != null ? Arrays.hashCode(keys) : 0); result = 31 * result + (lockOwner != null ? lockOwner.hashCode() : 0); return result; }
/** * Clear all regions from this command factory. * * @param regions collection of regions to clear */ public void clearRegions(Collection<? extends InfinispanBaseRegion> regions) { regions.forEach(region -> allRegions.remove(ByteString.fromString(region.getCache().getName()))); }
@Override public void setCacheManager(EmbeddedCacheManager cm) { this.cache = cm.getCache(cacheName.toString()).getAdvancedCache(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof ClusteredQueryCommand)) return false; ClusteredQueryCommand other = (ClusteredQueryCommand) obj; if (cacheName == null) { if (other.cacheName != null) return false; } else if (!cacheName.equals(other.cacheName)) return false; if (query == null) { if (other.query != null) return false; } else if (!query.equals(other.query)) return false; return true; }
@Override public int hashCode() { int result = cacheName.hashCode(); result = 31 * result + xid.hashCode(); return result; }
/** * Add region so that commands can be cleared on shutdown. * * @param region instance to keep track of */ public void addRegion(InfinispanBaseRegion region) { allRegions.put(ByteString.fromString(region.getCache().getName()), region); }