gpt4 book ai didi

org.infinispan.commons.marshall.WrappedByteArray.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-26 20:49:05 28 4
gpt4 key购买 nike

本文整理了Java中org.infinispan.commons.marshall.WrappedByteArray.<init>()方法的一些代码示例,展示了WrappedByteArray.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WrappedByteArray.<init>()方法的具体详情如下:
包路径:org.infinispan.commons.marshall.WrappedByteArray
类名称:WrappedByteArray
方法名:<init>

WrappedByteArray.<init>介绍

暂无

代码示例

代码示例来源:origin: org.infinispan/infinispan-commons

@Override
public Object wrap(Object obj) {
 if (obj instanceof byte[]) return new WrappedByteArray((byte[]) obj);
 return obj;
}

代码示例来源:origin: org.infinispan/infinispan-commons

@Override
 public WrappedByteArray readObject(ObjectInput input) throws IOException {
   byte[] bytes = MarshallUtil.unmarshallByteArray(input);
   boolean hasHashCode = input.readBoolean();
   if (hasHashCode) {
    return new WrappedByteArray(bytes, input.readInt());
   } else {
    return new WrappedByteArray(bytes);
   }
 }
}

代码示例来源:origin: org.infinispan/infinispan-core

private WrappedByteArray toUserObject(byte[] bytes) {
   return new WrappedByteArray(bytes);
  }
}

代码示例来源:origin: org.infinispan/infinispan-server-hotrod

boolean removeClientListener(byte[] listenerId, Cache cache) {
 Object sender = eventSenders.get(new WrappedByteArray(listenerId));
 if (sender != null) {
   cache.removeListener(sender);
   return true;
 } else return false;
}

代码示例来源:origin: org.infinispan/infinispan-server-hotrod

void removeEntry(HotRodHeader header, Subject subject, byte[] key, byte[] value) {
 log.trace("Call removeEntry");
 WrappedByteArray keyWrappped = new WrappedByteArray(key);
 WrappedByteArray valueWrapped = new WrappedByteArray(value);
 server.multimap(header, subject).remove(keyWrappped, valueWrapped).whenComplete(handleBoolean(header));
}

代码示例来源:origin: org.infinispan/infinispan-server-hotrod

void containsEntry(HotRodHeader header, Subject subject, byte[] key, byte[] value) {
 log.trace("Call containsEntry");
 WrappedByteArray keyWrappped = new WrappedByteArray(key);
 WrappedByteArray valueWrapped = new WrappedByteArray(value);
 server.multimap(header, subject).containsEntry(keyWrappped, valueWrapped).whenComplete(handleBoolean(header));
}

代码示例来源:origin: org.infinispan/infinispan-server-hotrod

TestCounterNotificationManager(HotRodClient client) {
 this.client = client;
 byte[] listenerId = new byte[16];
 ThreadLocalRandom.current().nextBytes(listenerId);
 this.listenerId = new WrappedByteArray(listenerId);
 userListenerList = new ConcurrentHashMap<>();
}

代码示例来源:origin: org.infinispan/infinispan-server-hotrod

void get(HotRodHeader header, Subject subject, byte[] key) {
 if (trace) {
   log.trace("Call get");
 }
 WrappedByteArray keyWrappped = new WrappedByteArray(key);
 server.multimap(header, subject).get(keyWrappped).whenComplete(
    (result, throwable) -> handleGet(header, result, throwable));
}

代码示例来源:origin: org.infinispan/infinispan-server-hotrod

void removeKey(HotRodHeader header, Subject subject, byte[] key) {
 if (trace) {
   log.trace("Call removeKey");
 }
 WrappedByteArray keyWrappped = new WrappedByteArray(key);
 server.multimap(header, subject).remove(keyWrappped).whenComplete(handleBoolean(header));
}

代码示例来源:origin: org.infinispan.server/infinispan-server-testsuite

private String convertToStrWrappedArray(String keyAsString) {
  WrappedByteArray wrappedByteArray = new WrappedByteArray(keyAsString.getBytes(UTF_8));
  return STRING_MAPPER.getStringMapping(wrappedByteArray);
}

代码示例来源:origin: org.infinispan/infinispan-server-hotrod

void containsKey(HotRodHeader header, Subject subject, byte[] key) {
 log.trace("Call containsKey");
 WrappedByteArray keyWrappped = new WrappedByteArray(key);
 server.multimap(header, subject).containsKey(keyWrappped).whenComplete(handleBoolean(header));
}

代码示例来源:origin: org.infinispan/infinispan-server-hotrod

void getWithMetadata(HotRodHeader header, Subject subject, byte[] key) {
 if (trace) {
   log.trace("Call getWithMetadata");
 }
 WrappedByteArray keyWrappped = new WrappedByteArray(key);
 server.multimap(header, subject).getEntry(keyWrappped).whenComplete((entry, throwable) -> handleGetWithMetadata(header, entry, throwable));
}

代码示例来源:origin: org.infinispan/infinispan-server-hotrod

private ContextValue performGet(byte[] key) {
 TestGetWithMetadataResponse response = client.getWithMetadata(key, 0);
 ContextValue contextValue = response.data
    .map(bytes -> new ContextValue(response.dataVersion, (byte) 0, bytes))
    .orElseGet(RemoteTransaction::nonExisting);
 txContext.put(new WrappedByteArray(key), contextValue);
 return contextValue;
}

代码示例来源:origin: org.infinispan/infinispan-server-hotrod

private byte[] get(byte[] key) {
 log.debugf("GET[%s] (%s)", xid, printArray(key, true));
 ContextValue value = txContext.get(new WrappedByteArray(key));
 if (value != null) {
   return value.value;
 }
 return performGet(key).value;
}

代码示例来源:origin: org.infinispan/infinispan-server-hotrod

public TestCounterEventResponse(byte version, long messageId, HotRodOperation operation, ByteBuf buffer) {
 super(version, messageId, "", (byte) 0, operation, OperationStatus.Success, 0, null);
 counterName = ExtendedByteBuf.readString(buffer);
 listenerId = new WrappedByteArray(ExtendedByteBuf.readRangedBytes(buffer));
 byte counterState = buffer.readByte();
 counterEvent = new CounterEventImpl(buffer.readLong(), decodeOldState(counterState), buffer.readLong(),
    decodeNewState(counterState));
}

代码示例来源:origin: org.infinispan/infinispan-core

public void testEqualsAndHashCode() throws Exception {
 StreamingMarshaller marshaller = extractGlobalMarshaller(cache(0).getCacheManager());
 Pojo pojo = new Pojo();
 WrappedBytes wb = new WrappedByteArray(marshaller.objectToByteBuffer(pojo));
 WrappedBytes wb2 = new WrappedByteArray(marshaller.objectToByteBuffer(pojo));
 assertTrue(wb2.hashCode() == wb.hashCode());
 assertEquals(wb, wb2);
}

代码示例来源:origin: org.infinispan/infinispan-server-hotrod

public void testMarshallingCommandWithBigByteArrayKey() throws Exception {
 byte[] cacheKey = getBigByteArray();
 ClusteredGetCommand command =
    new ClusteredGetCommand(new WrappedByteArray(cacheKey), ByteString.fromString("c"), 0, EnumUtil.EMPTY_BIT_SET);
 byte[] bytes = marshaller.objectToByteBuffer(command);
 ClusteredGetCommand readCommand = (ClusteredGetCommand) marshaller.objectFromByteBuffer(bytes);
 assertEquals(readCommand, command);
}

代码示例来源:origin: org.infinispan/infinispan-server-hotrod

public void set(byte[] key, byte[] value, int lifespan, int maxIdle) {
 log.debugf("SET[%s] (%s, %s, %s, &s)", xid, printArray(key, true), printArray(value, true), lifespan, maxIdle);
 ContextValue contextValue = txContext.computeIfAbsent(new WrappedByteArray(key), RemoteTransaction::notRead);
 contextValue.set(value, lifespan, maxIdle);
}

代码示例来源:origin: org.infinispan/infinispan-core

private void putIntoStore(String key, String value) throws Exception {
 Cache<String, String> testCache = cacheManager.getCache(CACHE_NAME);
 CacheWriter<String, String> writer = TestingUtil.getFirstWriter(testCache);
 Object writerKey = key;
 Object writerValue = value;
 if (storage == StorageType.OFF_HEAP) {
   GlobalMarshaller gm = TestingUtil.extractGlobalMarshaller(testCache.getCacheManager());
   writerKey = new WrappedByteArray(gm.objectToByteBuffer(key));
   writerValue = new WrappedByteArray(gm.objectToByteBuffer(value));
 }
 MarshalledEntry entry = new MarshalledEntryImpl(writerKey, writerValue, null, null);
 writer.write(entry);
}

代码示例来源:origin: org.infinispan/infinispan-core

private boolean isEntryInStore(String key) throws Exception {
 Cache<String, String> testCache = cacheManager.getCache(CACHE_NAME);
 CacheLoader<String, String> loader = TestingUtil.getFirstLoader(testCache);
 Object loaderKey = key;
 if (storage == StorageType.OFF_HEAP) {
   GlobalMarshaller gm = TestingUtil.extractGlobalMarshaller(testCache.getCacheManager());
   loaderKey = new WrappedByteArray(gm.objectToByteBuffer(key));
 }
 return loader.contains(loaderKey);
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com