List of usage examples for io.netty.buffer ByteBuf equals
@Override public abstract boolean equals(Object obj);
From source file:org.redisson.transaction.BaseTransactionalMap.java
License:Apache License
private boolean isEqual(Object value, Object oldValue) { ByteBuf valueBuf = ((RedissonObject) map).encodeMapValue(value); ByteBuf oldValueBuf = ((RedissonObject) map).encodeMapValue(oldValue); try {//from ww w .j av a 2s . c om return valueBuf.equals(oldValueBuf); } finally { valueBuf.readableBytes(); oldValueBuf.readableBytes(); } }
From source file:org.redisson.transaction.BaseTransactionalSet.java
License:Apache License
private boolean isEqual(Object value, Object oldValue) { ByteBuf valueBuf = ((RedissonObject) set).encode(value); ByteBuf oldValueBuf = ((RedissonObject) set).encode(oldValue); try {//from w ww .j av a 2 s. c o m return valueBuf.equals(oldValueBuf); } finally { valueBuf.readableBytes(); oldValueBuf.readableBytes(); } }
From source file:org.redisson.transaction.RedissonTransactionalBucket.java
License:Apache License
private boolean isEquals(Object value, Object oldValue) { ByteBuf valueBuf = encode(value); ByteBuf oldValueBuf = encode(oldValue); try {//w w w .j a v a 2 s . com return valueBuf.equals(oldValueBuf); } finally { valueBuf.readableBytes(); oldValueBuf.readableBytes(); } }
From source file:ratpack.reload.internal.ReloadableFileBackedFactory.java
License:Apache License
private void refresh() throws Exception { lock.lock();/*from w ww . j a v a2 s . c o m*/ try { FileTime lastModifiedTime = Files.getLastModifiedTime(file); ByteBuf bytes = IoUtils.read(UnpooledByteBufAllocator.DEFAULT, file); if (lastModifiedTime.equals(lastModifiedHolder.get()) && bytes.equals(contentHolder.get())) { return; } T previous = delegateHolder.getAndSet(null); if (previous != null) { releaser.release(previous); } delegateHolder.set(producer.produce(file, bytes)); this.lastModifiedHolder.set(lastModifiedTime); this.contentHolder.set(bytes); } finally { lock.unlock(); } }
From source file:whitespell.net.websockets.socketio.transport.FlashPolicyHandler.java
License:Apache License
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof ByteBuf) { ByteBuf message = (ByteBuf) msg; ByteBuf data = message.slice(0, requestBuffer.readableBytes()); if (data.equals(requestBuffer)) { message.release();//from w ww . j av a2 s. co m ChannelFuture f = ctx.writeAndFlush(responseBuffer); f.addListener(ChannelFutureListener.CLOSE); return; } ctx.pipeline().remove(this); } ctx.fireChannelRead(msg); }